Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Clear L_SA from all LWPs in sigexit() to prevent an...



details:   https://anonhg.NetBSD.org/src/rev/16b8bd22e43c
branches:  trunk
changeset: 543127:16b8bd22e43c
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Mon Feb 17 23:45:00 2003 +0000

description:
Clear L_SA from all LWPs in sigexit() to prevent any upcalls or
sa_switch() invocations while exiting. Test P_SA instead of L_SA, out
of paranoia. Avoids a possible remrunqueue panic reported by Havard
Eidnes.

Release the kernel lock before calling the userret function to exit in
sigexit(). Problem noted by Paul Kranenburg.

diffstat:

 sys/kern/kern_sig.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 272dea10a388 -r 16b8bd22e43c sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Mon Feb 17 23:32:33 2003 +0000
+++ b/sys/kern/kern_sig.c       Mon Feb 17 23:45:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.135 2003/02/15 20:54:39 jdolecek Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.136 2003/02/17 23:45:00 nathanw Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.135 2003/02/15 20:54:39 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.136 2003/02/17 23:45:00 nathanw Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_sunos.h"
@@ -1574,6 +1574,7 @@
 sigexit(struct lwp *l, int signum)
 {
        struct proc     *p;
+       struct lwp      *l2;
        int             error, exitsig;
 
        p = l->l_proc;
@@ -1582,13 +1583,16 @@
         * Don't permit coredump() or exit1() multiple times 
         * in the same process.
         */
-       if (p->p_flag & P_WEXIT)
+       if (p->p_flag & P_WEXIT) {
+               KERNEL_PROC_UNLOCK(l);
                (*p->p_userret)(l, p->p_userret_arg);
+       }
        p->p_flag |= P_WEXIT;
        /* We don't want to switch away from exiting. */
        /* XXX multiprocessor: stop LWPs on other processors. */
-       if (l->l_flag & L_SA) {
-               l->l_flag &= ~L_SA;
+       if (p->p_flag & P_SA) {
+               LIST_FOREACH(l2, &p->p_lwps, l_sibling)
+                   l2->l_flag &= ~L_SA;
                p->p_flag &= ~P_SA;
        }
 



Home | Main Index | Thread Index | Old Index