Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by kami...



details:   https://anonhg.NetBSD.org/src/rev/aff80b9f6662
branches:  netbsd-9
changeset: 455388:aff80b9f6662
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 15 19:28:16 2019 +0000

description:
Pull up following revision(s) (requested by kamil in ticket #330):

        sys/kern/kern_sig.c: revision 1.372

Avoid double lwp_exit() in eventswitch()

For the PTRACE_LWP_EXIT event, the eventswitch() call is triggered from
lwp_exit(). In the case of setting the program status to PS_WEXIT, do not
try to demise in place, by calling lwp_exit() as it causes panic.

In this scenario bail out from the function and resume the lwp_exit()
procedure.

diffstat:

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

diffs (31 lines):

diff -r 548ece8d7119 -r aff80b9f6662 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Tue Oct 15 19:27:04 2019 +0000
+++ b/sys/kern/kern_sig.c       Tue Oct 15 19:28:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 martin Exp $        */
+/*     $NetBSD: kern_sig.c,v 1.364.2.7 2019/10/15 19:28:16 martin 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.364.2.6 2019/10/15 19:27:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.7 2019/10/15 19:28:16 martin Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1612,6 +1612,12 @@
        if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) {
                mutex_exit(p->p_lock);
                mutex_exit(proc_lock);
+
+               if (pe_report_event == PTRACE_LWP_EXIT) {
+                       /* Avoid double lwp_exit() and panic. */
+                       return;
+               }
+
                lwp_exit(l);
                panic("eventswitch");
                /* NOTREACHED */



Home | Main Index | Thread Index | Old Index