summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-02-16 05:23:44 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-02-16 05:23:44 +0000
commitb816c1f65d3f19a3b5bc58d0525b05626d459161 (patch)
tree3d226f546852d86e739f4f137a7901511e814406 /sys
parent44f40f71730f2ae11e5e967e9cb8c06b0dbfe653 (diff)
In exec_setup_stack(), move the stack in the right direction if
MACHINE_STACK_GROWS_UP.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/exec_subr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c
index 1e34ed57b50..17ff312c3db 100644
--- a/sys/kern/exec_subr.c
+++ b/sys/kern/exec_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_subr.c,v 1.48 2015/02/09 11:52:47 miod Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.49 2015/02/16 05:23:43 miod Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@@ -345,8 +345,13 @@ exec_setup_stack(struct proc *p, struct exec_package *epp)
sgap = arc4random() & (stackgap_random - 1);
sgap = trunc_page(sgap);
+#ifdef MACHINE_STACK_GROWS_UP
+ epp->ep_maxsaddr += sgap;
+ epp->ep_minsaddr += sgap;
+#else
epp->ep_maxsaddr -= sgap;
epp->ep_minsaddr -= sgap;
+#endif
}
/*