From: guenther Date: Mon, 7 Feb 2022 19:30:48 +0000 (+0000) Subject: Delete STACKGAPLEN: this exec-time allocation at the top of the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2f033923a701422d03b324678cbaa49598138bca;p=openbsd Delete STACKGAPLEN: this exec-time allocation at the top of the original thread's stack hasn't been used since 2015. ok miod@ deraadt@ --- 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; } diff --git a/sys/sys/exec.h b/sys/sys/exec.h index a2c75023f81..2829ad490e0 100644 --- a/sys/sys/exec.h +++ b/sys/sys/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.46 2021/12/09 00:26:10 guenther Exp $ */ +/* $OpenBSD: exec.h,v 1.47 2022/02/07 19:30:48 guenther Exp $ */ /* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */ /*- @@ -57,12 +57,6 @@ struct ps_strings { int ps_nenvstr; /* the number of environment strings */ }; -/* - * Below the PS_STRINGS and sigtramp, we may require a gap on the stack - * (used to copyin/copyout various XXX emulation data structures). - */ -#define STACKGAPLEN (2*1024) /* plenty enough for now */ - /* * the following structures allow execve() to put together processes * in a more extensible and cleaner way.