Commit 570ac933 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

ptrace: task_stopped_code(ptrace => true) can't see TASK_STOPPED task

task_stopped_code()->task_is_stopped_or_traced() doesn't look right, the
traced task must never be TASK_STOPPED.

We can not add WARN_ON(task_is_stopped(p)), but this is only because
do_wait() can race with PTRACE_ATTACH from another thread.

[akpm@linux-foundation.org: teeny cleanup]
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Roland McGrath <roland@hack.frob.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Cc: Pedro Alves <palves@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7c3b00e0
...@@ -1120,8 +1120,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) ...@@ -1120,8 +1120,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
static int *task_stopped_code(struct task_struct *p, bool ptrace) static int *task_stopped_code(struct task_struct *p, bool ptrace)
{ {
if (ptrace) { if (ptrace) {
if (task_is_stopped_or_traced(p) && if (task_is_traced(p) && !(p->jobctl & JOBCTL_LISTENING))
!(p->jobctl & JOBCTL_LISTENING))
return &p->exit_code; return &p->exit_code;
} else { } else {
if (p->signal->flags & SIGNAL_STOP_STOPPED) if (p->signal->flags & SIGNAL_STOP_STOPPED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment