Commit e6ceb32aa25fc33f21af84cc7a32fe289b3e860c

Authored by Scott James Remnant
Committed by Linus Torvalds
1 parent 14816b1e2b

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: Scott James Remnant <scott@ubuntu.com>
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -1388,7 +1388,7 @@
1388 1388 if (unlikely(!exit_code) || unlikely(p->exit_state))
1389 1389 goto bail_ref;
1390 1390 return wait_noreap_copyout(p, pid, uid,
1391   - why, (exit_code << 8) | 0x7f,
  1391 + why, exit_code,
1392 1392 infop, ru);
1393 1393 }
1394 1394