From: Oleg Nesterov Date: Fri, 8 Feb 2008 12:19:00 +0000 (-0800) Subject: ptrace_stop: fix the race with ptrace detach+attach X-Git-Tag: v2.6.25-rc1~230 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6405f7f4675884b671bee66678e1c2859bdb0e56;p=pandora-kernel.git 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 Acked-by: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed