mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-27 05:21:08 +01:00
Fix the child's return path from fork so that fork will return 0
in the child. This corrects a problem where linux/alpha binaries see the child's return value of fork as the parent's pid. This happens because linux/alpha binaries apparently check the return value directly, rather than looking for a non-zero value in a4, as *BSD & OSF/1 do. Reviewed by:dfr@nlsystems.com
This commit is contained in:
parent
b6e3808f9b
commit
34067f9475
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50458
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
|
||||
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
|
||||
* $Id: vm_machdep.c,v 1.18 1999/07/22 06:03:42 alc Exp $
|
||||
* $Id: vm_machdep.c,v 1.19 1999/08/05 23:38:13 jdp Exp $
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
@ -187,9 +187,9 @@ cpu_fork(p1, p2)
|
||||
/*
|
||||
* Set up return-value registers as fork() libc stub expects.
|
||||
*/
|
||||
p2tf->tf_regs[FRAME_V0] = p1->p_pid; /* parent's pid */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child */
|
||||
p2tf->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
|
||||
|
||||
/*
|
||||
* Arrange for continuation at child_return(), which
|
||||
|
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
|
||||
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
|
||||
* $Id: vm_machdep.c,v 1.18 1999/07/22 06:03:42 alc Exp $
|
||||
* $Id: vm_machdep.c,v 1.19 1999/08/05 23:38:13 jdp Exp $
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
@ -187,9 +187,9 @@ cpu_fork(p1, p2)
|
||||
/*
|
||||
* Set up return-value registers as fork() libc stub expects.
|
||||
*/
|
||||
p2tf->tf_regs[FRAME_V0] = p1->p_pid; /* parent's pid */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child */
|
||||
p2tf->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
|
||||
|
||||
/*
|
||||
* Arrange for continuation at child_return(), which
|
||||
|
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
|
||||
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
|
||||
* $Id: vm_machdep.c,v 1.18 1999/07/22 06:03:42 alc Exp $
|
||||
* $Id: vm_machdep.c,v 1.19 1999/08/05 23:38:13 jdp Exp $
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
@ -187,9 +187,9 @@ cpu_fork(p1, p2)
|
||||
/*
|
||||
* Set up return-value registers as fork() libc stub expects.
|
||||
*/
|
||||
p2tf->tf_regs[FRAME_V0] = p1->p_pid; /* parent's pid */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child */
|
||||
p2tf->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
|
||||
|
||||
/*
|
||||
* Arrange for continuation at child_return(), which
|
||||
|
Loading…
Reference in New Issue
Block a user