diff options
author | Andrew Morgan <morgan@kernel.org> | 2008-02-05 01:29:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:20 -0500 |
commit | e338d263a76af78fe8f38a72131188b58fceb591 (patch) | |
tree | f3f046fc6fd66de43de7191830f0daf3bc4ec8eb /mm/oom_kill.c | |
parent | 8f6936f4d29aa14e54a2470b954a2e1f96322988 (diff) |
Add 64-bit capability support to the kernel
The patch supports legacy (32-bit) capability userspace, and where possible
translates 32-bit capabilities to/from userspace and the VFS to 64-bit
kernel space capabilities. If a capability set cannot be compressed into
32-bits for consumption by user space, the system call fails, with -ERANGE.
FWIW libcap-2.00 supports this change (and earlier capability formats)
http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
[akpm@linux-foundation.org: coding-syle fixes]
[akpm@linux-foundation.org: use get_task_comm()]
[ezk@cs.sunysb.edu: build fix]
[akpm@linux-foundation.org: do not initialise statics to 0 or NULL]
[akpm@linux-foundation.org: unused var]
[serue@us.ibm.com: export __cap_ symbols]
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: James Morris <jmorris@namei.org>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 96473b482099..320d74e707af 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -125,8 +125,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
125 | * Superuser processes are usually more important, so we make it | 125 | * Superuser processes are usually more important, so we make it |
126 | * less likely that we kill those. | 126 | * less likely that we kill those. |
127 | */ | 127 | */ |
128 | if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_ADMIN) || | 128 | if (__capable(p, CAP_SYS_ADMIN) || p->uid == 0 || p->euid == 0) |
129 | p->uid == 0 || p->euid == 0) | ||
130 | points /= 4; | 129 | points /= 4; |
131 | 130 | ||
132 | /* | 131 | /* |
@@ -135,7 +134,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
135 | * tend to only have this flag set on applications they think | 134 | * tend to only have this flag set on applications they think |
136 | * of as important. | 135 | * of as important. |
137 | */ | 136 | */ |
138 | if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO)) | 137 | if (__capable(p, CAP_SYS_RAWIO)) |
139 | points /= 4; | 138 | points /= 4; |
140 | 139 | ||
141 | /* | 140 | /* |