Commit e6ceb32a authored by Scott James Remnant's avatar Scott James Remnant Committed by Linus Torvalds

wait_task_stopped(): pass correct exit_code to wait_noreap_copyout()

In wait_task_stopped() exit_code already contains the right value for the
si_status member of siginfo, and this is simply set in the non WNOWAIT
case.

If you call waitid() with a stopped or traced process, you'll get the signal
in siginfo.si_status as expected -- however if you call waitid(WNOWAIT) at the
same time, you'll get the signal << 8 | 0x7f

Pass it unchanged to wait_noreap_copyout(); we would only need to shift it
and add 0x7f if we were returning it in the user status field and that
isn't used for any function that permits WNOWAIT.
Signed-off-by: default avatarScott James Remnant <scott@ubuntu.com>
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 14816b1e
...@@ -1388,7 +1388,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader, ...@@ -1388,7 +1388,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
if (unlikely(!exit_code) || unlikely(p->exit_state)) if (unlikely(!exit_code) || unlikely(p->exit_state))
goto bail_ref; goto bail_ref;
return wait_noreap_copyout(p, pid, uid, return wait_noreap_copyout(p, pid, uid,
why, (exit_code << 8) | 0x7f, why, exit_code,
infop, ru); infop, ru);
} }
......
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