Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

userns: Handle -1 in k[ug]id_has_mapping when !CONFIG_USER_NS

Refuse to admit any user namespace has a mapping of the INVALID_UID
and the INVALID_GID when !CONFIG_USER_NS.

Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

+2 -2
+2 -2
include/linux/uidgid.h
··· 177 177 178 178 static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid) 179 179 { 180 - return true; 180 + return uid_valid(uid); 181 181 } 182 182 183 183 static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) 184 184 { 185 - return true; 185 + return gid_valid(gid); 186 186 } 187 187 188 188 #endif /* CONFIG_USER_NS */