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/177fc23cf3a5
branches:  netbsd-9
changeset: 458501:177fc23cf3a5
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 15 19:27:04 2019 +0000

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

        sys/kern/kern_sig.c: revision 1.371

Fix one the the root causes of unreliability of the ptrace(2)ed threads

In case of sigswitchin away in issignal() and continuing the execution on
PT_CONTINUE (or equivalent call), there is a time window when another
thread could cause the process state to be changed to PS_STOPPING.

In the current logic, a thread would receive signal 0 (no-signal) and exit
from issignal(), returning to userland and never finishing the process of
stopping all LWPs. This causes hangs waitpid() waiting for SIGCHLD and
the callout polling for the state of the process in an infinite loop.

Instead of prompting for a returned signal from a debugger, repeat the
issignal() loop, this will cause checking the PS_STOPPING flag again and
sigswitching away in the scenario of stopping the process.

diffstat:

 sys/kern/kern_sig.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 27e962aaae7c -r 177fc23cf3a5 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Tue Oct 15 19:25:11 2019 +0000
+++ b/sys/kern/kern_sig.c       Tue Oct 15 19:27:04 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $        */
+/*     $NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 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.5 2019/10/15 19:25:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 martin Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1863,7 +1863,7 @@
                if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) {
                        sigswitch_unlock_and_switch_away(l);
                        mutex_enter(p->p_lock);
-                       signo = sigchecktrace();
+                       continue;
                } else if (p->p_stat == SACTIVE)
                        signo = sigchecktrace();
                else



Home | Main Index | Thread Index | Old Index