public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zap_other_threads() detaches thread group leader
@ 2003-08-09 19:17 Matt Wilson
  2003-08-12  7:40 ` Roland McGrath
  0 siblings, 1 reply; 12+ messages in thread
From: Matt Wilson @ 2003-08-09 19:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Ingo Molnar, Roland McGrath, manfred, Andrew Morton

Hi.

The change to detach the threads in zap_other_threads() broke the case
where the non-thread-group-leader is the cause of de_thread().  In
this case the group leader will be detached and freed before
switch_exec_pids() is complete and invalid data will be used.
This is a patch that makes sure that the group leader does not get
detached and reaped.

Thought that Ingo or Roland submitted this for me, but since it's
still not in test3 I figured I would send it myself.  Please CC: me on
replies.

Cheers,

Matt
msw@redhat.com

--- linux-2.6.0-test3/kernel/signal.c.zap	2003-08-09 14:58:50.000000000 -0400
+++ linux-2.6.0-test3/kernel/signal.c	2003-08-09 14:59:42.000000000 -0400
@@ -1011,9 +1011,11 @@ void zap_other_threads(struct task_struc
 		 * 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.
+		 * the process.  But don't detach the thread group
+		 * leader.
 		 */
-		t->exit_signal = -1;
+		if (t != p->group_leader)
+			t->exit_signal = -1;
 
 		sigaddset(&t->pending.signal, SIGKILL);
 		rm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-08-14 20:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-09 19:17 [PATCH] zap_other_threads() detaches thread group leader Matt Wilson
2003-08-12  7:40 ` Roland McGrath
2003-08-12  7:52   ` [PATCH] revert zap_other_threads breakage, disallow CLONE_THREAD without CLONE_DETACHED Roland McGrath
2003-08-13  7:11     ` Jeremy Fitzhardinge
2003-08-13  9:37       ` Roland McGrath
2003-08-14 17:32     ` Linus Torvalds
2003-08-14 17:53       ` Jamie Lokier
2003-08-14 18:03         ` Linus Torvalds
2003-08-14 18:27           ` Jamie Lokier
2003-08-14 18:33             ` Linus Torvalds
2003-08-14 18:38               ` Jamie Lokier
2003-08-14 20:56       ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox