]> git.baikalelectronics.ru Git - kernel.git/commit
oom_kill: remove uid==0 checks
authorSerge E. Hallyn <serue@us.ibm.com>
Tue, 5 Feb 2008 06:29:47 +0000 (22:29 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 5 Feb 2008 17:44:20 +0000 (09:44 -0800)
commit18afaa7c6a97953250bc5f136a10588f34f45562
tree4af91977d82494375e09a961594f83ca77f253d7
parentc2d579b3f1d80ad4dcd2c1c86d3b5325bafb0e08
oom_kill: remove uid==0 checks

Root processes are considered more important when out of memory and killing
proceses.  The check for CAP_SYS_ADMIN was augmented with a check for
uid==0 or euid==0.

There are several possible ways to look at this:

1. uid comparisons are unnecessary, trust CAP_SYS_ADMIN
   alone.  However CAP_SYS_RESOURCE is the one that really
   means "give me extra resources" so allow for that as
   well.
2. Any privileged code should be protected, but uid is not
   an indication of privilege.  So we should check whether
   any capabilities are raised.
3. uid==0 makes processes on the host as well as in containers
   more important, so we should keep the existing checks.
4. uid==0 makes processes only on the host more important,
   even without any capabilities.  So we should be keeping
   the (uid==0||euid==0) check but only when
   userns==&init_user_ns.

I'm following number 1 here.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Cc: Andrew Morgan <morgan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/oom_kill.c