diff mbox

exec: Use a define for maximum process stack size in STACK_GROWSUP case.

Message ID 87a5b0801001220557s3a62742n369741a5d0e3ef94@mail.gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Will Newton Jan. 22, 2010, 1:57 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/exec.c b/fs/exec.c
index 632b02e..d37a626 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -573,10 +573,13 @@  int setup_arg_pages(struct linux_binprm *bprm,
 	unsigned long stack_base;

 #ifdef CONFIG_STACK_GROWSUP
-	/* Limit stack size to 1GB */
+	/* Limit stack size to 1GB by default. */
+#ifndef STACK_MAX_SIZE
+#define STACK_MAX_SIZE (1 << 30)
+#endif
 	stack_base = current->signal->rlim[RLIMIT_STACK].rlim_max;
-	if (stack_base > (1 << 30))
-		stack_base = 1 << 30;
+	if (stack_base > STACK_MAX_SIZE)
+		stack_base = STACK_MAX_SIZE;

 	/* Make sure we didn't let the argument array grow too large. */
 	if (vma->vm_end - vma->vm_start > stack_base)