Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Set p_oppid always, not just when a parent is traced



details:   https://anonhg.NetBSD.org/src/rev/15d444f16535
branches:  trunk
changeset: 1009172:15d444f16535
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Apr 14 22:42:18 2020 +0000

description:
Set p_oppid always, not just when a parent is traced

PR kern/55151 by Martin Husemann

diffstat:

 sys/kern/kern_exec.c |  10 +++++-----
 sys/kern/kern_fork.c |  10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (64 lines):

diff -r 8dac14bdfc2e -r 15d444f16535 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Tue Apr 14 22:37:24 2020 +0000
+++ b/sys/kern/kern_exec.c      Tue Apr 14 22:42:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.495 2020/04/06 08:20:05 kamil Exp $    */
+/*     $NetBSD: kern_exec.c,v 1.496 2020/04/14 22:42:18 kamil Exp $    */
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.495 2020/04/06 08:20:05 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.496 2020/04/14 22:42:18 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -2658,10 +2658,10 @@
        p2->p_exitsig = SIGCHLD;        /* signal for parent on exit */
 
        if ((p1->p_slflag & (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) ==
-           (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) {
+           (PSL_TRACEPOSIX_SPAWN|PSL_TRACED))
                proc_changeparent(p2, p1->p_pptr);
-               p2->p_oppid = p1->p_pid;
-       }
+
+       p2->p_oppid = p1->p_pid;  /* Remember the original parent id. */
 
        LIST_INSERT_AFTER(p1, p2, p_pglist);
        LIST_INSERT_HEAD(&allproc, p2, p_list);
diff -r 8dac14bdfc2e -r 15d444f16535 sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c      Tue Apr 14 22:37:24 2020 +0000
+++ b/sys/kern/kern_fork.c      Tue Apr 14 22:42:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_fork.c,v 1.221 2020/04/06 08:20:05 kamil Exp $    */
+/*     $NetBSD: kern_fork.c,v 1.222 2020/04/14 22:42:18 kamil Exp $    */
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008, 2019
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.221 2020/04/06 08:20:05 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.222 2020/04/14 22:42:18 kamil Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -511,10 +511,10 @@
        /*
         * Trace fork(2) and vfork(2)-like events on demand in a debugger.
         */
-       if (tracefork(p1, flags) || tracevfork(p1, flags)) {
+       if (tracefork(p1, flags) || tracevfork(p1, flags))
                proc_changeparent(p2, p1->p_pptr);
-               p2->p_oppid = p1->p_pid;
-       }
+
+       p2->p_oppid = p1->p_pid; /* Remember the original parent id. */
 
        LIST_INSERT_AFTER(p1, p2, p_pglist);
        LIST_INSERT_HEAD(&allproc, p2, p_list);



Home | Main Index | Thread Index | Old Index