From eb44a44184e42ed2afb0d1e898b6cb3f683bcccf Mon Sep 17 00:00:00 2001 From: Will Newton Date: Fri, 22 Jan 2010 13:51:31 +0000 Subject: [PATCH] exec: Use a define for maximum process stack size in STACK_GROWSUP case. Create a new define for the maximum allowed process stack size for STACK_GROWSUP architectures. This allows the value to be overridden in architecture specific code where necessary. Signed-off-by: Will Newton --- fs/exec.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) 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) -- 1.5.5.2