Skip to content

Commit

Permalink
tracehook: force signal_pending()
Browse files Browse the repository at this point in the history
This defines a new hook tracehook_force_sigpending() that lets tracing
code decide to force TIF_SIGPENDING on in recalc_sigpending().

This is not used yet, so it compiles away to nothing for now.  It lays the
groundwork for new tracing code that can interrupt a task synthetically
without actually sending a signal.

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed Jul 26, 2008
1 parent 2b2a1ff commit b787f7b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions include/linux/tracehook.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,20 @@ static inline int tracehook_consider_fatal_signal(struct task_struct *task,
return (task_ptrace(task) & PT_PTRACED) != 0;
}

/**
* tracehook_force_sigpending - let tracing force signal_pending(current) on
*
* Called when recomputing our signal_pending() flag. Return nonzero
* to force the signal_pending() flag on, so that tracehook_get_signal()
* will be called before the next return to user mode.
*
* Called with @current->sighand->siglock held.
*/
static inline int tracehook_force_sigpending(void)
{
return 0;
}

/**
* tracehook_get_signal - deliver synthetic signal to traced task
* @task: @current
Expand Down
4 changes: 3 additions & 1 deletion kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ void recalc_sigpending_and_wake(struct task_struct *t)

void recalc_sigpending(void)
{
if (!recalc_sigpending_tsk(current) && !freezing(current))
if (unlikely(tracehook_force_sigpending()))
set_thread_flag(TIF_SIGPENDING);
else if (!recalc_sigpending_tsk(current) && !freezing(current))
clear_thread_flag(TIF_SIGPENDING);

}
Expand Down

0 comments on commit b787f7b

Please sign in to comment.