This patch introduces a 1GB stack size limit for stack-grows-up (ie
PA-RISC), as discussed previously.
/* 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;