summaryrefslogtreecommitdiff
path: root/fs/exec.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@debian.org>2003-09-09 19:44:26 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-09-09 19:44:26 -0700
commit53949f83f58918afe80eae89ab6ffe2dba8aaf5f (patch)
tree2f97f06c60a8f21d715a4cb3abefd4b1a855c5b8 /fs/exec.c
parentb9f079914aa775bc9e2985f6c4263d46c4f80f1a (diff)
[PATCH] 1GB stack size limit on PA-RISC
This patch introduces a 1GB stack size limit for stack-grows-up (ie PA-RISC), as discussed previously.
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/exec.c b/fs/exec.c
index ce0332bd2105..862a1a183d3a 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -374,7 +374,13 @@ int setup_arg_pages(struct linux_binprm *bprm)
/* Adjust bprm->p to point to the end of the strings. */
bprm->p = PAGE_SIZE * i - offset;
- stack_base = STACK_TOP - current->rlim[RLIMIT_STACK].rlim_max;
+
+ /* Limit stack size to 1GB */
+ stack_base = current->rlim[RLIMIT_STACK].rlim_max;
+ if (stack_base > (1 << 30))
+ stack_base = 1 << 30;
+ stack_base = PAGE_ALIGN(STACK_TOP - stack_base);
+
mm->arg_start = stack_base;
arg_size = i << PAGE_SHIFT;