summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-04-03 14:56:29 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-04-03 14:56:29 +0000
commit445a93dfa951cfdb8d9253fd13836d6a25a4ac4b (patch)
tree9248ed7a9eb63023a13f069c04bd049ee460f416 /sys/arch/amd64
parente3f9e42db6dd7e48f8bd5a3da7d5b2bb44f3752f (diff)
Move PPWAIT flag from struct proc to process, so that rthreads in
a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created. ok blambert@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/syscall.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/syscall.c b/sys/arch/amd64/amd64/syscall.c
index 928dabb0d7d..cabe03827e4 100644
--- a/sys/arch/amd64/amd64/syscall.c
+++ b/sys/arch/amd64/amd64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.15 2010/06/26 23:24:43 guenther Exp $ */
+/* $OpenBSD: syscall.c,v 1.16 2011/04/03 14:56:28 guenther Exp $ */
/* $NetBSD: syscall.c,v 1.1 2003/04/26 18:39:32 fvdl Exp $ */
/*-
@@ -210,7 +210,9 @@ child_return(void *arg)
if (KTRPOINT(p, KTR_SYSRET)) {
KERNEL_PROC_LOCK(p);
ktrsysret(p,
- (p->p_flag & P_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0);
+ (p->p_flag & P_THREAD) ? SYS_rfork :
+ (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork,
+ 0, 0);
KERNEL_PROC_UNLOCK(p);
}
#endif