summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-10-28 21:57:32 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-10-28 21:57:32 +0000
commitd945a449d16e4652dda69e0b58cf743fbe330730 (patch)
treef51d2737067f18eec2dbe3d6b30efbb6049464be /sys
parent74a85857d12ec5ff87f98daa5d8d6d25ccba20d8 (diff)
Check for init(8) return path by process ID and make it the exception rather
than the default. ok deraadt@, weingart@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/vm_machdep.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vm_machdep.c b/sys/arch/amd64/amd64/vm_machdep.c
index f75fbc7bf86..43c83eb5630 100644
--- a/sys/arch/amd64/amd64/vm_machdep.c
+++ b/sys/arch/amd64/amd64/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.4 2004/09/20 17:51:05 miod Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.5 2005/10/28 21:57:31 kettenis Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 2003/04/26 18:39:33 fvdl Exp $ */
/*-
@@ -146,10 +146,11 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize,
sf = (struct switchframe *)tf - 1;
sf->sf_r12 = (u_int64_t)func;
sf->sf_r13 = (u_int64_t)arg;
- if (func == child_return)
- sf->sf_rip = (u_int64_t)child_trampoline;
- else
+ /* XXX fork of init(8) returns via proc_trampoline() */
+ if (p2->p_pid == 1)
sf->sf_rip = (u_int64_t)proc_trampoline;
+ else
+ sf->sf_rip = (u_int64_t)child_trampoline;
pcb->pcb_rsp = (u_int64_t)sf;
pcb->pcb_rbp = 0;
}