Skip to content

Commit

Permalink
signal: make sure we don't get stopped with pending task_work
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jul 22, 2012
1 parent 1e0ea00 commit 7266702
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,13 @@ static void ptrace_do_notify(int signr, int exit_code, int why)
void ptrace_notify(int exit_code)
{
BUG_ON((exit_code & (0x7f | ~0xffff)) != SIGTRAP);
if (unlikely(current->task_works)) {
if (test_and_clear_ti_thread_flag(current_thread_info(),
TIF_NOTIFY_RESUME)) {
smp_mb__after_clear_bit();
task_work_run();
}
}

spin_lock_irq(&current->sighand->siglock);
ptrace_do_notify(SIGTRAP, exit_code, CLD_TRAPPED);
Expand Down Expand Up @@ -2191,6 +2198,14 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
struct signal_struct *signal = current->signal;
int signr;

if (unlikely(current->task_works)) {
if (test_and_clear_ti_thread_flag(current_thread_info(),
TIF_NOTIFY_RESUME)) {
smp_mb__after_clear_bit();
task_work_run();
}
}

if (unlikely(uprobe_deny_signal()))
return 0;

Expand Down

0 comments on commit 7266702

Please sign in to comment.