Commit 1ee1184485df9c9a3503d3a684b911fb7c73d259
Committed by
Linus Torvalds
1 parent
95a3540da9
Exists in
master
and in
7 other branches
ptrace_untrace: fix the SIGNAL_STOP_STOPPED check
This bug is ancient too. ptrace_untrace() must not resume the task if the group stop in progress, we should set TASK_STOPPED instead. Unfortunately, we still have problems here: - if the process/thread was traced, SIGNAL_STOP_STOPPED does not necessary means this thread group is stopped. - ptrace breaks the bookkeeping of ->group_stop_count. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Roland McGrath <roland@redhat.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff
kernel/ptrace.c
... | ... | @@ -60,11 +60,15 @@ |
60 | 60 | { |
61 | 61 | spin_lock(&child->sighand->siglock); |
62 | 62 | if (task_is_traced(child)) { |
63 | - if (child->signal->flags & SIGNAL_STOP_STOPPED) { | |
63 | + /* | |
64 | + * If the group stop is completed or in progress, | |
65 | + * this thread was already counted as stopped. | |
66 | + */ | |
67 | + if (child->signal->flags & SIGNAL_STOP_STOPPED || | |
68 | + child->signal->group_stop_count) | |
64 | 69 | __set_task_state(child, TASK_STOPPED); |
65 | - } else { | |
70 | + else | |
66 | 71 | signal_wake_up(child, 1); |
67 | - } | |
68 | 72 | } |
69 | 73 | spin_unlock(&child->sighand->siglock); |
70 | 74 | } |