]> git.neil.brown.name Git - history.git/commitdiff
When zapping the thread list due to an execve(), make sure to
authorLinus Torvalds <torvalds@home.osdl.org>
Sun, 27 Jul 2003 02:19:28 +0000 (19:19 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 27 Jul 2003 02:19:28 +0000 (19:19 -0700)
also detach the threads.

Otherwise we'll leave them around as zombies, waiting for them
to be picked up by their parent. Which might be the execve()
thread itself, causing a deadlock.

kernel/signal.c

index 7ac72191b30bf0e38bce5ceb99c1caf6d30af484..cd0690a66f244ad06975ba0f0f9667d90911db46 100644 (file)
@@ -1000,6 +1000,15 @@ void zap_other_threads(struct task_struct *p)
                return;
 
        for (t = next_thread(p); t != p; t = next_thread(t)) {
+               /*
+                * We don't want to notify the parent, since we are
+                * killed as part of a thread group due to another
+                * thread doing an execve() or similar. So set the
+                * exit signal to -1 to allow immediate reaping of
+                * the process.
+                */
+               t->exit_signal = -1;
+
                sigaddset(&t->pending.signal, SIGKILL);
                rm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);
                signal_wake_up(t, 1);