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

From: Will Newton
Date: Fri Jan 22 2010 - 08:58:17 EST


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 <will.newton@xxxxxxxxx>
---

The only in-tree architecture this affects is parisc. I don't have a
parisc box here to test with, but I have tested this change on an
out-of-tree Linux port with STACK_GROWSUP set.

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

Attachment: 0001-exec-Use-a-define-for-maximum-process-stack-size-in.patch
Description: Binary data