]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
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 ea24eae8a576b0f0edcd0b81df56660199d0bf17..4c2d2cb1c1d50591c8fe6811d74a1d0cf2fa7464 100644 (file)
@@ -1034,7 +1034,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 7669f19a05ffb337d00b46213797180d50c640f2..eca75f02403fdd60851ade3874d8729b3e5bfb4e 100644 (file)
@@ -1003,6 +1003,7 @@ bool current_in_userns(const struct user_namespace *target_ns)
        }
        return false;
 }
+EXPORT_SYMBOL(current_in_userns);
 
 static inline struct user_namespace *to_user_ns(struct ns_common *ns)
 {