]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
[PATCH] Fix ptrace self-attach rule
authorLinus Torvalds <torvalds@osdl.org>
Wed, 9 Nov 2005 19:37:57 +0000 (11:37 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2005 05:22:08 +0000 (21:22 -0800)
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: Linus Torvalds <torvalds@osdl.org>
kernel/ptrace.c

index 019e04ec065a55d8f28157d3a1f7ba06cafd347f..fcfc4568b45f3f190ba320b0d5853836921cb8bc 100644 (file)
@@ -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)