lkml.org 
[lkml]   [2008]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2.6.27-rc5] Allow set RLIMIT_NOFILE to RLIM_INFINITY
Hi all,

when process wants set limit of open files to RLIM_INFINITY it gets
EPERM even if it has CAP_SYS_RESOURCE capability. Attached patch
should fix the problem. Please add me to CC of your responses because
I'm not member of list.

Regards, Adam

--
Adam Tkac
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1458,8 +1458,14 @@ asmlinkage long sys_setrlimit(unsigned i
if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
!capable(CAP_SYS_RESOURCE))
return -EPERM;
- if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
- return -EPERM;
+ if (resource == RLIMIT_NOFILE) {
+ if (new_rlim.rlim_max == RLIM_INFINITY)
+ new_rlim.rlim_max = sysctl_nr_open;
+ if (new_rlim.rlim_cur == RLIM_INFINITY)
+ new_rlim.rlim_cur = sysctl_nr_open;
+ if (new_rlim.rlim_max > sysctl_nr_open)
+ return -EPERM;
+ }

retval = security_task_setrlimit(resource, &new_rlim);
if (retval)
\
 
 \ /
  Last update: 2008-09-09 09:17    [W:0.047 / U:2.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site