Module Name:    src
Committed By:   christos
Date:           Wed Jan 25 18:26:26 UTC 2012

Modified Files:
        src/sys/kern: kern_exec.c
        src/sys/sys: param.h

Log Message:
Add a macro to align the length of the stack, not the pointer itself, since
we always want the alignment to grow the length.


To generate a diff of this commit:
cvs rdiff -u -r1.334 -r1.335 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.400 -r1.401 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.334 src/sys/kern/kern_exec.c:1.335
--- src/sys/kern/kern_exec.c:1.334	Tue Jan 24 15:03:36 2012
+++ src/sys/kern/kern_exec.c	Wed Jan 25 13:26:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.334 2012/01/24 20:03:36 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.335 2012/01/25 18:26:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.334 2012/01/24 20:03:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.335 2012/01/25 18:26:26 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_ktrace.h"
@@ -793,7 +793,7 @@ execve1(struct lwp *l, const char *path,
 #endif /* PAX_ASLR */
 
 	/* make the stack "safely" aligned */
-	len = (size_t)STACK_ALIGN(len, STACK_ALIGNBYTES);
+	len = STACK_LEN_ALIGN(len, STACK_ALIGNBYTES);
 
 	if (len > pack.ep_ssize) { /* in effect, compare to initial limit */
 		DPRINTF(("%s: stack limit exceeded %zu\n", __func__, len));

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.400 src/sys/sys/param.h:1.401
--- src/sys/sys/param.h:1.400	Tue Jan 24 15:03:36 2012
+++ src/sys/sys/param.h	Wed Jan 25 13:26:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.400 2012/01/24 20:03:36 christos Exp $	*/
+/*	$NetBSD: param.h,v 1.401 2012/01/25 18:26:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -224,6 +224,7 @@
 #define	STACK_ALLOC(sp, _size)		(((char *)(void *)(sp)) - (_size))
 #define	STACK_MAX(p, _size)		((char *)(void *)(p))
 #endif
+#define	STACK_LEN_ALIGN(len, bytes)	((len) + bytes) & ~bytes)
 
 #endif /* defined(_KERNEL) || defined(__EXPOSE_STACK) */
 

Reply via email to