linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Anton Blanchard <anton@samba.org>, Andrew Morton <akpm@digeo.com>,
	Arjan van de Ven <arjanv@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: heavy handed exit() in latest BK
Date: Sun, 9 Feb 2003 03:56:50 -0800	[thread overview]
Message-ID: <200302091156.h19BuoH07869@magilla.sf.frob.com> (raw)
In-Reply-To: Ingo Molnar's message of  Sunday, 9 February 2003 12:40:32 +0100 <Pine.LNX.4.44.0302091236590.4454-100000@localhost.localdomain>

>  - a read_lock(&tasklist_lock) is missing around the group_send_sig_info()
>    in send_sig_info().

Indeed.  I still intend to clean up those entry points and haven't gotten
to it, so I hadn't bothered with this yet either (though I think I sent it
to you for the backport).  It certainly does bite in practice, e.g. SIGPIPE.

There is a similar failure to take the lock before using zap_other_threads.
I thought I sent this patch before, but it's not in 2.5 yet.

--- /home/roland/redhat/linux-2.5.59-1.1007/fs/exec.c.~1~	Fri Feb  7 20:04:27 2003
+++ /home/roland/redhat/linux-2.5.59-1.1007/fs/exec.c	Sun Feb  9 03:43:36 2003
@@ -601,9 +601,12 @@ static inline int de_thread(struct task_
 
 	if (thread_group_empty(current))
 		goto no_thread_group;
+
 	/*
-	 * Kill all other threads in the thread group:
+	 * Kill all other threads in the thread group.
+	 * We must hold tasklist_lock to call zap_other_threads.
 	 */
+	read_lock(&tasklist_lock);
 	spin_lock_irq(lock);
 	if (oldsig->group_exit) {
 		/*
@@ -611,6 +614,7 @@ static inline int de_thread(struct task_
 		 * return so that the signal is processed.
 		 */
 		spin_unlock_irq(lock);
+		read_unlock(&tasklist_lock);
 		kmem_cache_free(sighand_cachep, newsighand);
 		if (newsig)
 			kmem_cache_free(signal_cachep, newsig);
@@ -629,12 +633,15 @@ static inline int de_thread(struct task_
 		oldsig->group_exit_task = current;
 		current->state = TASK_UNINTERRUPTIBLE;
 		spin_unlock_irq(lock);
+		read_unlock(&tasklist_lock);
 		schedule();
+		read_lock(&tasklist_lock);
 		spin_lock_irq(lock);
 		if (oldsig->group_exit_task)
 			BUG();
 	}
 	spin_unlock_irq(lock);
+	read_unlock(&tasklist_lock);
 
 	/*
 	 * At this point all other threads have exited, all we have to


>  - session-IDs and group-IDs are set outside the tasklist lock. This
>    causes breakage in the USB code. The correct fix is to do this:

This is outside the part of the code that I've touched lately.


Thanks,
Roland

  reply	other threads:[~2003-02-09 11:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200302091130.h19BU2107744@magilla.sf.frob.com>
2003-02-09 11:40 ` heavy handed exit() in latest BK Ingo Molnar
2003-02-09 11:56   ` Roland McGrath [this message]
2003-02-09 12:09     ` Ingo Molnar
2003-02-09 12:18     ` Ingo Molnar
2003-02-09 12:23       ` Ingo Molnar
2003-02-09 12:22         ` Arjan van de Ven
2003-02-10  1:07     ` Linus Torvalds
2003-02-10  1:27       ` Roland McGrath
2003-02-09  0:57 Anton Blanchard
2003-02-09  2:00 ` Linus Torvalds
2003-02-09  2:17   ` Roland McGrath
2003-02-09  2:19     ` Linus Torvalds
2003-02-09  2:31       ` Roland McGrath
2003-02-09  2:34         ` Linus Torvalds
2003-02-09  2:33   ` Linus Torvalds
2003-02-09  2:41     ` Roland McGrath
2003-02-09  3:30     ` Roland McGrath
2003-02-09  3:33       ` Roland McGrath
2003-02-09  3:37         ` Linus Torvalds
2003-02-09  3:40           ` Linus Torvalds
2003-02-09  3:48         ` Roland McGrath
2003-02-09  4:51           ` Linus Torvalds
2003-02-09  4:57             ` Linus Torvalds
2003-02-09  5:00             ` Roland McGrath
2003-02-09  9:28             ` Russell King
2003-02-10  8:53   ` Ingo Molnar
2003-02-10 15:22     ` Linus Torvalds

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=200302091156.h19BuoH07869@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@digeo.com \
    --cc=anton@samba.org \
    --cc=arjanv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).