
This patch limits the maximum stack size on PA-RISC to 1GB, as previously
discussed.

diff -u parisc-2.6/fs/exec.c parisc-2.6/fs/exec.c
--- parisc-2.6/fs/exec.c	Tue Aug 12 13:29:42 2003
+++ parisc-2.6/fs/exec.c	Tue Aug 12 13:29:42 2003
@@ -374,7 +374,13 @@
 
 	/* 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;
 
