diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-01-04 11:29:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-04 18:01:59 -0500 |
commit | 8a88951b5878dc475dcd841cefc767e36397d14e (patch) | |
tree | c31fd8cdfa08dce4768f42e556d97929deac2343 /kernel/signal.c | |
parent | 50b8d257486a45cba7b65ca978986ed216bbcc10 (diff) |
ptrace: ensure JOBCTL_STOP_SIGMASK is not zero after detach
This is the temporary simple fix for 3.2, we need more changes in this
area.
1. do_signal_stop() assumes that the running untraced thread in the
stopped thread group is not possible. This was our goal but it is
not yet achieved: a stopped-but-resumed tracee can clone the running
thread which can initiate another group-stop.
Remove WARN_ON_ONCE(!current->ptrace).
2. A new thread always starts with ->jobctl = 0. If it is auto-attached
and this group is stopped, __ptrace_unlink() sets JOBCTL_STOP_PENDING
but JOBCTL_STOP_SIGMASK part is zero, this triggers WANR_ON(!signr)
in do_jobctl_trap() if another debugger attaches.
Change __ptrace_unlink() to set the artificial SIGSTOP for report.
Alternatively we could change ptrace_init_task() to copy signr from
current, but this means we can copy it for no reason and hide the
possible similar problems.
Acked-by: Tejun Heo <tj@kernel.org>
Cc: <stable@kernel.org> [3.1]
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index b3f78d09a105..206551563cce 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1994,8 +1994,6 @@ static bool do_signal_stop(int signr) | |||
1994 | */ | 1994 | */ |
1995 | if (!(sig->flags & SIGNAL_STOP_STOPPED)) | 1995 | if (!(sig->flags & SIGNAL_STOP_STOPPED)) |
1996 | sig->group_exit_code = signr; | 1996 | sig->group_exit_code = signr; |
1997 | else | ||
1998 | WARN_ON_ONCE(!current->ptrace); | ||
1999 | 1997 | ||
2000 | sig->group_stop_count = 0; | 1998 | sig->group_stop_count = 0; |
2001 | 1999 | ||