Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Disable PTRACE_FORK for vforked() children, because...
details: https://anonhg.NetBSD.org/src/rev/3a8bcca59b64
branches: trunk
changeset: 773433:3a8bcca59b64
user: christos <christos%NetBSD.org@localhost>
date: Thu Feb 02 02:44:06 2012 +0000
description:
Disable PTRACE_FORK for vforked() children, because the parent is waiting
and will not receive the SIGTRAP in time.
diffstat:
sys/kern/kern_fork.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r 7f3bfe2869b2 -r 3a8bcca59b64 sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c Wed Feb 01 23:43:49 2012 +0000
+++ b/sys/kern/kern_fork.c Thu Feb 02 02:44:06 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_fork.c,v 1.186 2011/09/02 20:06:29 christos Exp $ */
+/* $NetBSD: kern_fork.c,v 1.187 2012/02/02 02:44:06 christos Exp $ */
/*-
* Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.186 2011/09/02 20:06:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.187 2012/02/02 02:44:06 christos Exp $");
#include "opt_ktrace.h"
@@ -460,8 +460,12 @@
LIST_INSERT_HEAD(&parent->p_children, p2, p_sibling);
p2->p_exitsig = exitsig; /* signal for parent on exit */
+ /*
+ * We don't want to tracefork vfork()ed processes because they
+ * will not receive the SIGTRAP until it is too late.
+ */
tracefork = (p1->p_slflag & (PSL_TRACEFORK|PSL_TRACED)) ==
- (PSL_TRACEFORK|PSL_TRACED);
+ (PSL_TRACEFORK|PSL_TRACED) && (flags && FORK_PPWAIT) == 0;
if (tracefork) {
p2->p_slflag |= PSL_TRACED;
p2->p_opptr = p2->p_pptr;
Home |
Main Index |
Thread Index |
Old Index