]> git.hungrycats.org Git - linux/commitdiff
[PATCH] 1GB stack size limit on PA-RISC
authorMatthew Wilcox <willy@debian.org>
Wed, 10 Sep 2003 02:44:26 +0000 (19:44 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 10 Sep 2003 02:44:26 +0000 (19:44 -0700)
This patch introduces a 1GB stack size limit for stack-grows-up (ie
PA-RISC), as discussed previously.

fs/exec.c

index ce0332bd2105611e8f1a1c37a68e741fcd1964ea..862a1a183d3a6b87ee71f3a4d9465a10680b62f6 100644 (file)
--- 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;