]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: (namespace) fuse: Restrict allow_other to the superblock's namespace...
authorSeth Forshee <seth.forshee@canonical.com>
Thu, 2 Oct 2014 20:34:45 +0000 (15:34 -0500)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 29 Jan 2018 13:44:56 +0000 (07:44 -0600)
Unprivileged users are normally restricted from mounting with the
allow_other option by system policy, but this could be bypassed
for a mount done with user namespace root permissions. In such
cases allow_other should not allow users outside the userns
to access the mount as doing so would give the unprivileged user
the ability to manipulate processes it would otherwise be unable
to manipulate. Restrict allow_other to apply to users in the same
userns used at mount or a descendant of that namespace. Also
export current_in_userns() for use by fuse when built as a
module.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/fuse/dir.c
kernel/user_namespace.c

index ad1cfac1942f35d9486be9011d57d4a88f5519a8..d41559a0aa6bda88132b5992ca2b8218e514c2dc 100644 (file)
@@ -1030,7 +1030,7 @@ int fuse_allow_current_process(struct fuse_conn *fc)
        const struct cred *cred;
 
        if (fc->allow_other)
-               return 1;
+               return current_in_userns(fc->user_ns);
 
        cred = current_cred();
        if (uid_eq(cred->euid, fc->user_id) &&
index 8859e95e7031e106c9fbf2c42affe8b1f908c402..08d638386b83c4765365aa9ea233a2868380953f 100644 (file)
@@ -1241,6 +1241,7 @@ bool current_in_userns(const struct user_namespace *target_ns)
 {
        return in_userns(target_ns, current_user_ns());
 }
+EXPORT_SYMBOL(current_in_userns);
 
 static inline struct user_namespace *to_user_ns(struct ns_common *ns)
 {