diff options
author | Oleg Nesterov <oleg@redhat.com> | 2009-06-17 16:27:31 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 13:03:51 -0700 |
commit | b79b7ba93df14a1fc0b8d4d6d78a0e097de03bbd (patch) | |
tree | 65ce7c7335fc1dd0a91a3224466c4eaa0ec489f4 /kernel/perf_counter.c | |
parent | 5cb11446892833e50970fb2277a9f7563b0a8bd3 (diff) |
ptrace: ptrace_attach: check PF_KTHREAD + exit_state instead of ->mm
- Add PF_KTHREAD check to prevent attaching to the kernel thread
with a borrowed ->mm.
With or without this change we can race with daemonize() which
can set PF_KTHREAD or clear ->mm after ptrace_attach() does the
check, but this doesn't matter because reparent_to_kthreadd()
does ptrace_unlink().
- Kill "!task->mm" check. We don't really care about ->mm != NULL,
and the task can call exit_mm() right after we drop task_lock().
What we need is to make sure we can't attach after exit_notify(),
check task->exit_state != 0 instead.
Also, move the "already traced" check down for cosmetic reasons.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Chris Wright <chrisw@sous-sol.org>
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>
Diffstat (limited to 'kernel/perf_counter.c')
0 files changed, 0 insertions, 0 deletions