diff options
| author | Roland McGrath <roland@redhat.com> | 2005-01-14 23:39:11 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-14 23:39:11 -0800 |
| commit | 0f9dea3fc12cfac611ca90d0ed0f6cbc063d2134 (patch) | |
| tree | bf58e16470c37339629589e6856cea260bd74e54 /fs/exec.c | |
| parent | 040e3e09c0905972d58c290240e1f626a8692565 (diff) | |
[PATCH] fix exec deadlock when ptrace used inside the thread group
If one thread uses ptrace on another thread in the same thread group, there
can be a deadlock when calling exec. The ptrace_stop change ensures that
no tracing stop can be entered for a queued signal, or exit tracing, if the
tracer is part of the same dying group. The exit_notify change prevents a
ptrace zombie from sticking around if its tracer is in the midst of a group
exit (which an exec fakes), so these zombies don't hold up de_thread's
synchronization. The de_thread change ensures the new thread group leader
doesn't wind up ptracing itself, which would produce its own deadlocks.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/exec.c')
| -rw-r--r-- | fs/exec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c index 24f873e55080..8459791d6bc1 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -685,6 +685,14 @@ static inline int de_thread(struct task_struct *tsk) */ ptrace = leader->ptrace; parent = leader->parent; + if (unlikely(ptrace) && unlikely(parent == current)) { + /* + * Joker was ptracing his own group leader, + * and now he wants to be his own parent! + * We can't have that. + */ + ptrace = 0; + } ptrace_unlink(current); ptrace_unlink(leader); |
