Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Remove the short-circuit lwp_exit() path from sigsw...



details:   https://anonhg.NetBSD.org/src/rev/cb3decee8912
branches:  trunk
changeset: 455340:cb3decee8912
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Oct 15 13:59:57 2019 +0000

description:
Remove the short-circuit lwp_exit() path from sigswitch()

sigswitch() can be called from exit1() through:

   ttywait()->ttysleep()-> cv_timedwait_sig()->sleepq_block()->issignal()->sigswitch()

lwp_exit() called for the last LWP triggers exit1() and this causes a panic.

The debugger related signals have short-circuit demise paths in
eventswitch() and other functions, before calling sigswitch().

This change restores the original behavior, but there is an open question
whether the kernel crash is a red herring of misbehavior of ttywait().

This should fix PR kern/54618 by David H. Gutteridge

diffstat:

 sys/kern/kern_sig.c |  19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diffs (40 lines):

diff -r a416cf6a8401 -r cb3decee8912 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Tue Oct 15 13:27:50 2019 +0000
+++ b/sys/kern/kern_sig.c       Tue Oct 15 13:59:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.372 2019/10/13 03:50:26 kamil Exp $     */
+/*     $NetBSD: kern_sig.c,v 1.373 2019/10/15 13:59:57 kamil Exp $     */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.372 2019/10/13 03:50:26 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.373 2019/10/15 13:59:57 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1713,21 +1713,6 @@
        }
 
        /*
-        * If we are exiting, demise now.
-        *
-        * This avoids notifying tracer and deadlocking.
-        */
-       if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) {
-               mutex_exit(p->p_lock);
-               if (proc_lock_held) {
-                       mutex_exit(proc_lock);
-               }
-               lwp_exit(l);
-               panic("sigswitch");
-               /* NOTREACHED */
-       }
-
-       /*
         * On entry we know that the process needs to stop.  If it's
         * the result of a 'sideways' stop signal that has been sourced
         * through issignal(), then stop other LWPs in the process too.



Home | Main Index | Thread Index | Old Index