]> git.hungrycats.org Git - linux/commit
[PATCH] Fix two bugs with process limits (RLIMIT_NPROC)
authorAndrew Morton <akpm@osdl.org>
Fri, 18 Jul 2003 02:26:32 +0000 (19:26 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 18 Jul 2003 02:26:32 +0000 (19:26 -0700)
commit909cc4ae86f3380152a18e2a3c44523893ee11c4
treee298521ece55ee905e69fc8b1b24357aff9ac5b5
parent89001a8467ce34b178cb142cfcd2023b19cc063e
[PATCH] Fix two bugs with process limits (RLIMIT_NPROC)

From: Neil Brown <neilb@cse.unsw.edu.au>

1/ If a setuid process swaps it's real and effective uids and then forks,
 the fork fails if the new realuid has more processes
 than the original process was limited to.
 This is particularly a problem if a user with a process limit
 (e.g. 256) runs a setuid-root program which does setuid() + fork()
 (e.g. lprng) while root already has more than 256 process (which
 is quite possible).

 The root problem here is that a limit which should be a per-user
 limit is being implemented as a per-process limit with
 per-process (e.g. CAP_SYS_RESOURCE) controls.
 Being a per-user limit, it should be that the root-user can over-ride
 it, not just some process with CAP_SYS_RESOURCE.

 This patch adds a test to ignore process limits if the real user is root.

2/ When a root-owned process (e.g. cgiwrap) sets up process limits and then
  calls setuid, the setuid should fail if the user would then be running
  more than rlim_cur[RLIMIT_NPROC] processes, but it doesn't.  This patch
  adds an appropriate test.  With this patch, and per-user process limit
  imposed in cgiwrap really works.
kernel/fork.c
kernel/sys.c