[parisc-linux-cvs] linux willy
Matthew Wilcox
matthew@wil.cx
Mon, 18 Jun 2001 21:51:32 +0100
On Mon, Jun 18, 2001 at 02:32:56PM -0600, Matthew Wilcox wrote:
> Log message:
> Limit the stack size to 1GB. This fixes ssh sessions dying with
> glibc-2.2.3-6
Index: arch/parisc/kernel/sys_parisc32.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/sys_parisc32.c,v
retrieving revision 1.17
diff -u -p -r1.17 sys_parisc32.c
--- sys_parisc32.c 2001/06/12 02:36:11 1.17
+++ sys_parisc32.c 2001/06/18 20:31:52
@@ -1075,8 +1075,12 @@ asmlinkage long sys32_setrlimit(unsigned
if (new_rlim.rlim_cur > NR_OPEN || new_rlim.rlim_max > NR_OPEN)
return -EPERM;
}
- if (resource == RLIMIT_STACK)
+ if (resource == RLIMIT_STACK) {
+ if (new_rlim.rlim_max > 1024 * 1024 * 1024) {
+ new_rlim.rlim_max = 1024 * 1024 * 1024;
+ }
new_rlim.rlim_max = PAGE_ALIGN(new_rlim.rlim_max);
+ }
#if 0
printk("setrlimit %d to %lx %lx by %s\n", resource, new_rlim.rlim_cur,
new_rlim.rlim_max, current->comm);
Index: kernel/sys.c
===================================================================
RCS file: /home/cvs/parisc/linux/kernel/sys.c,v
retrieving revision 1.7
diff -u -p -r1.7 sys.c
--- sys.c 2001/04/02 20:54:08 1.7
+++ sys.c 2001/06/18 20:31:53
@@ -1076,11 +1076,17 @@ asmlinkage long sys_setrlimit(unsigned i
if (new_rlim.rlim_cur > NR_OPEN || new_rlim.rlim_max > NR_OPEN)
return -EPERM;
}
+#ifdef __hppa__
/* Code makes assumptions about RLIMIT_STACK being page aligned
* in various places (e.g. setup_arg_pages()).
*/
- if (resource == RLIMIT_STACK)
+ if (resource == RLIMIT_STACK) {
+ if (new_rlim.rlim_max > 1024 * 1024 * 1024) {
+ new_rlim.rlim_max = 1024 * 1024 * 1024;
+ }
new_rlim.rlim_max = PAGE_ALIGN(new_rlim.rlim_max);
+ }
+#endif
*old_rlim = new_rlim;
return 0;
}
--
Revolutions do not require corporate support.