diff options
author | Andy Lutomirski | 2013-04-14 13:44:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-04-25 14:51:23 -0500 |
commit | 37ed4a3f3bb107bfb307610b9ab2b87db03df3a6 (patch) | |
tree | 4217265b5f8a960f5f8c041e616f373959481b64 /kernel | |
parent | be4c1b46075d42cbd82bc0d1e833dc4de052ae85 (diff) | |
download | kernel-omap-37ed4a3f3bb107bfb307610b9ab2b87db03df3a6.tar.gz kernel-omap-37ed4a3f3bb107bfb307610b9ab2b87db03df3a6.tar.xz kernel-omap-37ed4a3f3bb107bfb307610b9ab2b87db03df3a6.zip |
userns: Changing any namespace id mappings should require privileges
commit 41c21e351e79004dbb4efa4bc14a53a7e0af38c5 upstream.
Changing uid/gid/projid mappings doesn't change your id within the
namespace; it reconfigures the namespace. Unprivileged programs should
*not* be able to write these files. (We're also checking the privileges
on the wrong task.)
Given the write-once nature of these files and the other security
checks, this is likely impossible to usefully exploit.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/user_namespace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index fdf40d6cf8a4..f359dc7fb8c5 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -576,10 +576,10 @@ static ssize_t map_write(struct file *file, const char __user *buf, | |||
576 | if (map->nr_extents != 0) | 576 | if (map->nr_extents != 0) |
577 | goto out; | 577 | goto out; |
578 | 578 | ||
579 | /* Require the appropriate privilege CAP_SETUID or CAP_SETGID | 579 | /* |
580 | * over the user namespace in order to set the id mapping. | 580 | * Adjusting namespace settings requires capabilities on the target. |
581 | */ | 581 | */ |
582 | if (cap_valid(cap_setid) && !ns_capable(ns, cap_setid)) | 582 | if (cap_valid(cap_setid) && !file_ns_capable(file, ns, CAP_SYS_ADMIN)) |
583 | goto out; | 583 | goto out; |
584 | 584 | ||
585 | /* Get a buffer */ | 585 | /* Get a buffer */ |