Fri Aug 26 12:52:01 2011 UTC ()
Fix a typo in r1.243: test for STACKALIGN not STACKLALIGN:

"If STACKALIGN is defined, use it instead of ALIGN.  Some arches need a
 stack more aligned that ALIGN will give."


(jmcneill)
diff -r1.323 -r1.324 src/sys/kern/kern_exec.c

cvs diff -r1.323 -r1.324 src/sys/kern/kern_exec.c (expand / switch to unified diff)

--- src/sys/kern/kern_exec.c 2011/08/26 09:29:16 1.323
+++ src/sys/kern/kern_exec.c 2011/08/26 12:52:01 1.324
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_exec.c,v 1.323 2011/08/26 09:29:16 reinoud Exp $ */ 1/* $NetBSD: kern_exec.c,v 1.324 2011/08/26 12:52:01 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -49,27 +49,27 @@ @@ -49,27 +49,27 @@
49 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 49 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
50 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 50 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 51 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
53 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 53 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
55 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 55 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
56 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 56 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
57 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 57 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
58 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */ 59 */
60 60
61#include <sys/cdefs.h> 61#include <sys/cdefs.h>
62__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.323 2011/08/26 09:29:16 reinoud Exp $"); 62__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.324 2011/08/26 12:52:01 jmcneill Exp $");
63 63
64#include "opt_ktrace.h" 64#include "opt_ktrace.h"
65#include "opt_modular.h" 65#include "opt_modular.h"
66#include "opt_syscall_debug.h" 66#include "opt_syscall_debug.h"
67#include "veriexec.h" 67#include "veriexec.h"
68#include "opt_pax.h" 68#include "opt_pax.h"
69#include "opt_sa.h" 69#include "opt_sa.h"
70 70
71#include <sys/param.h> 71#include <sys/param.h>
72#include <sys/systm.h> 72#include <sys/systm.h>
73#include <sys/filedesc.h> 73#include <sys/filedesc.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/proc.h> 75#include <sys/proc.h>
@@ -770,27 +770,27 @@ execve1(struct lwp *l, const char *path, @@ -770,27 +770,27 @@ execve1(struct lwp *l, const char *path,
770 aip = &arginfo; 770 aip = &arginfo;
771 ps_strings_sz = sizeof(struct ps_strings); 771 ps_strings_sz = sizeof(struct ps_strings);
772 len = ((argc + envc + 2 + pack.ep_esch->es_arglen) * 772 len = ((argc + envc + 2 + pack.ep_esch->es_arglen) *
773 sizeof(char *) + sizeof(int) + dp + RTLD_GAP + 773 sizeof(char *) + sizeof(int) + dp + RTLD_GAP +
774 szsigcode + ps_strings_sz + STACK_PTHREADSPACE) 774 szsigcode + ps_strings_sz + STACK_PTHREADSPACE)
775 - argp; 775 - argp;
776 } 776 }
777 777
778#ifdef PAX_ASLR 778#ifdef PAX_ASLR
779 if (pax_aslr_active(l)) 779 if (pax_aslr_active(l))
780 len += (arc4random() % PAGE_SIZE); 780 len += (arc4random() % PAGE_SIZE);
781#endif /* PAX_ASLR */ 781#endif /* PAX_ASLR */
782 782
783#ifdef STACKLALIGN /* arm, etc. */ 783#ifdef STACKALIGN /* arm, etc. */
784 len = STACKALIGN(len); /* make the stack "safely" aligned */ 784 len = STACKALIGN(len); /* make the stack "safely" aligned */
785#else 785#else
786 len = ALIGN(len); /* make the stack "safely" aligned */ 786 len = ALIGN(len); /* make the stack "safely" aligned */
787#endif 787#endif
788 788
789 if (len > pack.ep_ssize) { /* in effect, compare to initial limit */ 789 if (len > pack.ep_ssize) { /* in effect, compare to initial limit */
790 DPRINTF(("%s: stack limit exceeded %zu\n", __func__, len)); 790 DPRINTF(("%s: stack limit exceeded %zu\n", __func__, len));
791 error = ENOMEM; 791 error = ENOMEM;
792 goto bad; 792 goto bad;
793 } 793 }
794 794
795 /* Get rid of other LWPs. */ 795 /* Get rid of other LWPs. */
796 if (p->p_sa || p->p_nlwps > 1) { 796 if (p->p_sa || p->p_nlwps > 1) {