Commit 082d52c5 authored by Linus Torvalds's avatar Linus Torvalds Committed by Greg Kroah-Hartman

[PATCH] Fix ptrace self-attach rule

Before we did CLONE_THREAD, the way to check whether we were attaching
to ourselves was to just check "current == task", but with CLONE_THREAD
we should check that the thread group ID matches instead.
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 24547e2e
......@@ -152,7 +152,7 @@ int ptrace_attach(struct task_struct *task)
retval = -EPERM;
if (task->pid <= 1)
goto bad;
if (task == current)
if (task->tgid == current->tgid)
goto bad;
/* the same process cannot be attached many times */
if (task->ptrace & PT_PTRACED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment