diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 14:33:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 14:33:07 -0500 |
commit | 28d838cc4dfea980cb6eda0a7409cbf91889ca74 (patch) | |
tree | 4bbf42063718ac7744ca67ef9f67adce17bfbb5c | |
parent | ac111bfaa6b0b3c0edc63c27bd9617d6b08851ff (diff) |
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 <torvalds@osdl.org>
-rw-r--r-- | kernel/ptrace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 5b8dd98a230e..b88d4186cd7a 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *task) | |||
155 | retval = -EPERM; | 155 | retval = -EPERM; |
156 | if (task->pid <= 1) | 156 | if (task->pid <= 1) |
157 | goto bad; | 157 | goto bad; |
158 | if (task == current) | 158 | if (task->tgid == current->tgid) |
159 | goto bad; | 159 | goto bad; |
160 | /* the same process cannot be attached many times */ | 160 | /* the same process cannot be attached many times */ |
161 | if (task->ptrace & PT_PTRACED) | 161 | if (task->ptrace & PT_PTRACED) |