The patch titled ptrace: use safer wake up on ptrace_detach() has been added to the -mm tree. Its filename is ptrace-use-safer-wake-up-on-ptrace_detach.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ptrace: use safer wake up on ptrace_detach() From: Tejun Heo <tj@xxxxxxxxxx> The wake_up_process() call in ptrace_detach() is spurious and not interlocked with the tracee state. IOW, the tracee could be running or sleeping in any place in the kernel by the time wake_up_process() is called. This can lead to the tracee waking up unexpectedly which can be dangerous. The wake_up is spurious and should be removed but for now reduce its toxicity by only waking up if the tracee is in TRACED or STOPPED state. Signed-off-by: Tejun Heo <tj@xxxxxxxxxx> Cc: Roland McGrath <roland@xxxxxxxxxx> Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: <stable@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN kernel/ptrace.c~ptrace-use-safer-wake-up-on-ptrace_detach kernel/ptrace.c --- a/kernel/ptrace.c~ptrace-use-safer-wake-up-on-ptrace_detach +++ a/kernel/ptrace.c @@ -313,7 +313,7 @@ int ptrace_detach(struct task_struct *ch child->exit_code = data; dead = __ptrace_detach(current, child); if (!child->exit_state) - wake_up_process(child); + wake_up_state(child, TASK_TRACED | TASK_STOPPED); } write_unlock_irq(&tasklist_lock); _ Patches currently in -mm which might be from tj@xxxxxxxxxx are linux-next.patch ptrace-use-safer-wake-up-on-ptrace_detach.patch mm-numa-aware-alloc_task_struct_node.patch mm-numa-aware-alloc_thread_info_node.patch kthread-numa-aware-kthread_create_on_cpu.patch kthread-use-kthread_create_on_cpu.patch smp-move-smp-setup-functions-to-kernel-smpc.patch scatterlist-new-helper-functions.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html