From: Linus Torvalds Date: Wed, 9 Nov 2005 19:37:57 +0000 (-0800) Subject: [PATCH] Fix ptrace self-attach rule X-Git-Tag: v2.6.14.2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=082d52c56f642d21b771a13221068d40915a1409;p=karo-tx-linux.git [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: Linus Torvalds --- diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 019e04ec065a..fcfc4568b45f 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -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)