public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Wilson <msw@redhat.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Roland McGrath <roland@redhat.com>,
	manfred@colorfullife, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] zap_other_threads() detaches thread group leader
Date: Sat, 9 Aug 2003 15:17:48 -0400	[thread overview]
Message-ID: <20030809151748.B26520@devserv.devel.redhat.com> (raw)

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);

             reply	other threads:[~2003-08-09 19:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-09 19:17 Matt Wilson [this message]
2003-08-12  7:40 ` [PATCH] zap_other_threads() detaches thread group leader 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030809151748.B26520@devserv.devel.redhat.com \
    --to=msw@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife \
    --cc=mingo@redhat.com \
    --cc=roland@redhat.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox