Fix waitid si_code regression
authorRoland McGrath <roland@redhat.com>
Sat, 8 Mar 2008 19:41:22 +0000 (11:41 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 8 Mar 2008 19:54:00 +0000 (11:54 -0800)
In commit ee7c82da830ea860b1f9274f1f0cdf99f206e7c2 ("wait_task_stopped:
simplify and fix races with SIGCONT/SIGKILL/untrace"), the magic (short)
cast when storing si_code was lost in wait_task_stopped.  This leaks the
in-kernel CLD_* values that do not match what userland expects.

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/exit.c

index cd20bf0..53872bf 100644 (file)
@@ -1378,7 +1378,7 @@ unlock_sig:
        if (!retval && infop)
                retval = put_user(0, &infop->si_errno);
        if (!retval && infop)
-               retval = put_user(why, &infop->si_code);
+               retval = put_user((short)why, &infop->si_code);
        if (!retval && infop)
                retval = put_user(exit_code, &infop->si_status);
        if (!retval && infop)