diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2022-02-07 19:30:49 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2022-02-07 19:30:49 +0000 |
commit | d16dbed4a142a1fc15fd679910968f8f9ffcabf1 (patch) | |
tree | 4b6fdd02bb2993ec7551ff015892540b993b924e /sys/kern/kern_exec.c | |
parent | 1652efafdd0640e36f885f40134c8193f508bc00 (diff) |
Delete STACKGAPLEN: this exec-time allocation at the top of the
original thread's stack hasn't been used since 2015.
ok miod@ deraadt@
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 636e625385f..ab37a18c8dd 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.228 2021/12/09 00:26:10 guenther Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.229 2022/02/07 19:30:48 guenther Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -403,15 +403,15 @@ sys_execve(struct proc *p, void *v, register_t *retval) dp = (char *)(((long)dp + _STACKALIGNBYTES) & ~_STACKALIGNBYTES); - sgap = STACKGAPLEN; - /* * If we have enabled random stackgap, the stack itself has already * been moved from a random location, but is still aligned to a page * boundary. Provide the lower bits of random placement now. */ - if (stackgap_random != 0) { - sgap += arc4random() & PAGE_MASK; + if (stackgap_random == 0) { + sgap = 0; + } else { + sgap = arc4random() & PAGE_MASK; sgap = (sgap + _STACKALIGNBYTES) & ~_STACKALIGNBYTES; } |