diff options
author | Serge Hallyn <serue@us.ibm.com> | 2005-01-04 05:10:06 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-04 05:10:06 -0800 |
commit | 5d4e51371c28ccdb531abc2b0e95f1cef03f19e9 (patch) | |
tree | effdf3fa3f48e95fdd94436dcc0fb87e5274015f /kernel | |
parent | 2cf17bf6b5857ff2216931f4850cdd33ca2aab11 (diff) | |
download | history-5d4e51371c28ccdb531abc2b0e95f1cef03f19e9.tar.gz |
[PATCH] capset returns -EPERM when pid==current->pid
In the current kernel/capability.c:sys_capset() code, permission is
denied if CAP_SETPCAP is not held and pid is positive. pid=0 means use
the current process, and this is allowed. But using the current
process' pid is not allowed. The man page for capsetp simply says that
CAP_SETPCAP is required to use this function, and does not mention the
exception for pid=0.
The current behavior seems inconsistent. The attached patch also
allows a process to call capset() on itself.
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/capability.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/capability.c b/kernel/capability.c index 5dbadb36477f01..1d70f47058e847 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -173,7 +173,7 @@ asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) if (get_user(pid, &header->pid)) return -EFAULT; - if (pid && !capable(CAP_SETPCAP)) + if (pid && pid != current->pid && !capable(CAP_SETPCAP)) return -EPERM; if (copy_from_user(&effective, &data->effective, sizeof(effective)) || |