@@ -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)