Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add support for KTR logs of SIGTRAP for TRAP_CHILD ...



details:   https://anonhg.NetBSD.org/src/rev/ee1861686951
branches:  trunk
changeset: 457295:ee1861686951
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Jun 18 23:53:55 2019 +0000

description:
Add support for KTR logs of SIGTRAP for TRAP_CHILD events

Previously it was disabled due to vfork(2) synchronization issues.
These problems are now gone.

While there, set l_vforkwaiting to false in posix_spawn. This is not very
needed but it does not make harm to keep it initialized explicitly.

diffstat:

 sys/kern/kern_exec.c |   5 +++--
 sys/kern/kern_sig.c  |  13 ++++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r 85a5a68ea880 -r ee1861686951 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Tue Jun 18 23:11:05 2019 +0000
+++ b/sys/kern/kern_exec.c      Tue Jun 18 23:53:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.467 2019/06/13 20:20:18 kamil Exp $    */
+/*     $NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.467 2019/06/13 20:20:18 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -2470,6 +2470,7 @@
        }
 
        p2->p_lflag = 0;
+       l1->l_vforkwaiting = false;
        p2->p_sflag = 0;
        p2->p_slflag = 0;
        p2->p_pptr = p1;
diff -r 85a5a68ea880 -r ee1861686951 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Tue Jun 18 23:11:05 2019 +0000
+++ b/sys/kern/kern_sig.c       Tue Jun 18 23:53:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.360 2019/06/13 00:07:19 kamil Exp $     */
+/*     $NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 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.360 2019/06/13 00:07:19 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1621,9 +1621,12 @@
 
        sigswitch(0, signo, false);
 
-       /* XXX: hangs for VFORK */
-       if (code == TRAP_CHLD)
-               return;
+       if (code == TRAP_CHLD) {
+               mutex_enter(proc_lock);
+               while (l->l_vforkwaiting)
+                       cv_wait(&l->l_waitcv, proc_lock);
+               mutex_exit(proc_lock);
+       }
 
        if (ktrpoint(KTR_PSIG)) {
                if (p->p_emul->e_ktrpsig)



Home | Main Index | Thread Index | Old Index