summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-12-05 17:51:47 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-08 09:58:16 -0800
commitb8a0441b542f6d6bd6fda46cc735ae71392cb845 (patch)
tree2fd76af3ab01a1e8f36fb4d78e20667c674dc832 /kernel
parent4accc8c8e2dbb1f5ff3d8836244a9423bd5e11a9 (diff)
downloadlwn-b8a0441b542f6d6bd6fda46cc735ae71392cb845.tar.gz
lwn-b8a0441b542f6d6bd6fda46cc735ae71392cb845.zip
userns: Document what the invariant required for safe unprivileged mappings.
commit 0542f17bf2c1f2430d368f44c8fcf2f82ec9e53e upstream. The rule is simple. Don't allow anything that wouldn't be allowed without unprivileged mappings. It was previously overlooked that establishing gid mappings would allow dropping groups and potentially gaining permission to files and directories that had lesser permissions for a specific group than for all other users. This is the rule needed to fix CVE-2014-8989 and prevent any other security issues with new_idmap_permitted. The reason for this rule is that the unix permission model is old and there are programs out there somewhere that take advantage of every little corner of it. So allowing a uid or gid mapping to be established without privielge that would allow anything that would not be allowed without that mapping will result in expectations from some code somewhere being violated. Violated expectations about the behavior of the OS is a long way to say a security issue. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/user_namespace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 9bea1d7dd21f..59790206ca2e 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -800,7 +800,9 @@ static bool new_idmap_permitted(const struct file *file,
struct user_namespace *ns, int cap_setid,
struct uid_gid_map *new_map)
{
- /* Allow mapping to your own filesystem ids */
+ /* Don't allow mappings that would allow anything that wouldn't
+ * be allowed without the establishment of unprivileged mappings.
+ */
if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1)) {
u32 id = new_map->extent[0].lower_first;
if (cap_setid == CAP_SETUID) {