From: Roland McGrath Date: Wed, 14 Nov 2007 06:11:50 +0000 (-0800) Subject: wait_task_stopped: Check p->exit_state instead of TASK_TRACED X-Git-Tag: v2.6.24-rc3~12 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=a3474224e6a01924be40a8255636ea5522c1023a wait_task_stopped: Check p->exit_state instead of TASK_TRACED The original meaning of the old test (p->state > TASK_STOPPED) was "not dead", since it was before TASK_TRACED existed and before the state/exit_state split. It was a wrong correction in commit 14bf01bb0599c89fc7f426d20353b76e12555308 to make this test for TASK_TRACED instead. It should have been changed when TASK_TRACED was introducted and again when exit_state was introduced. Signed-off-by: Roland McGrath Cc: Oleg Nesterov Cc: Alexey Dobriyan Cc: Kees Cook Acked-by: Scott James Remnant Signed-off-by: Linus Torvalds --- Adjusted to apply to Debian's 2.6.18 by dann frazier diff -urpN linux-source-2.6.18.orig/kernel/exit.c linux-source-2.6.18/kernel/exit.c --- linux-source-2.6.18.orig/kernel/exit.c 2006-09-19 21:42:06.000000000 -0600 +++ linux-source-2.6.18/kernel/exit.c 2007-11-25 13:39:32.000000000 -0700 @@ -1287,8 +1287,7 @@ static int wait_task_stopped(struct task int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; exit_code = p->exit_code; - if (unlikely(!exit_code) || - unlikely(p->state & TASK_TRACED)) + if (unlikely(!exit_code) || unlikely(p->exit_state)) goto bail_ref; return wait_noreap_copyout(p, pid, uid, why, (exit_code << 8) | 0x7f,