diff options
author | Roland McGrath <roland@redhat.com> | 2004-10-22 20:07:11 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-22 20:07:11 -0700 |
commit | 66edd549f0b2750d6b98fdd608d65f6d72756d32 (patch) | |
tree | 8e37a5dc182a4b9e54059b9d08fce4195c4dbe2a /kernel | |
parent | 63bd6144f191d6d766f15ac39eb83ee9a1e484c6 (diff) | |
download | history-66edd549f0b2750d6b98fdd608d65f6d72756d32.tar.gz |
[PATCH] Fix ptrace problem
This is indeed a new bug, and it is not architecture-specific. In my
recent changes to close some race conditions, I overlooked the case of a
process using PTRACE_ATTACH on its own children. The new PT_ATTACHED flag
does not really mean "PTRACE_ATTACH was used", it means "PTRACE_ATTACH is
changing the ->parent link".
This fixes the problem that Stephane Eranian program demonstrates.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ptrace.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index c3ac348e236854..d78dafa86fc5a0 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -132,7 +132,8 @@ int ptrace_attach(struct task_struct *task) goto bad; /* Go */ - task->ptrace |= PT_PTRACED | PT_ATTACHED; + task->ptrace |= PT_PTRACED | ((task->real_parent != current) + ? PT_ATTACHED : 0); if (capable(CAP_SYS_PTRACE)) task->ptrace |= PT_PTRACE_CAP; task_unlock(task); |