]> git.baikalelectronics.ru Git - kernel.git/commit
ptrace_stop: fix the race with ptrace detach+attach
authorOleg Nesterov <oleg@tv-sign.ru>
Fri, 8 Feb 2008 12:19:00 +0000 (04:19 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 8 Feb 2008 17:22:26 +0000 (09:22 -0800)
commitdd6df6cf37f598a47949738d91a7b954176d9c8e
tree31f0e42b011de36976f5a50b86aee7132f6b82b4
parent7c0cdead9ac30e1c3b8bda8fa8cd69db113d02ad
ptrace_stop: fix the race with ptrace detach+attach

If the tracer went away (may_ptrace_stop() failed), ptrace_stop() drops
tasklist and then changes the ->state from TASK_TRACED to TASK_RUNNING.

This can fool another tracer which attaches to us in between.  Change the
->state under tasklist_lock to ensure that ptrace_check_attach() can't wrongly
succeed.  Also, remove the unnecessary mb().

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