Skip to content

Commit be7c6db

Browse files
committed
userns: Don't allow unprivileged creation of gid mappings
As any gid mapping will allow and must allow for backwards compatibility dropping groups don't allow any gid mappings to be established without CAP_SETGID in the parent user namespace. For a small class of applications this change breaks userspace and removes useful functionality. This small class of applications includes tools/testing/selftests/mount/unprivilged-remount-test.c Most of the removed functionality will be added back with the addition of a one way knob to disable setgroups. Once setgroups is disabled setting the gid_map becomes as safe as setting the uid_map. For more common applications that set the uid_map and the gid_map with privilege this change will have no affect. This is part of a fix for CVE-2014-8989. Cc: stable@vger.kernel.org Reviewed-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 273d2c6 commit be7c6db

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

‎kernel/user_namespace.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,6 @@ static bool new_idmap_permitted(const struct file *file,
821821
kuid_t uid = make_kuid(ns->parent, id);
822822
if (uid_eq(uid, file->f_cred->fsuid))
823823
return true;
824-
} else if (cap_setid == CAP_SETGID) {
825-
kgid_t gid = make_kgid(ns->parent, id);
826-
if (gid_eq(gid, file->f_cred->fsgid))
827-
return true;
828824
}
829825
}
830826

0 commit comments

Comments
 (0)