From 88f423c4b6a8dac0fac3bf330a351d1c394d7502 Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Wed, 24 Feb 2016 08:44:25 -0600 Subject: [PATCH] UBUNTU: SAUCE: kernfs: Always set super block owner to init_user_ns Filesystems implemented using kernfs are generally operating on a shared set of in-kernel objects even from different super blocks. Mounts from user namespaces should not have privileges towards all objects in these filesystems, so set s_user_ns in these super blocks to init_user_ns rather than the namespace of the mounter. Privileged users in a user namespace will still have privileges towards objects in the filesystem owned by users in that namespace. Signed-off-by: Seth Forshee --- fs/kernfs/mount.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 074bb8b..18ed4dc 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "kernfs-internal.h" @@ -227,7 +228,8 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, info->root = root; info->ns = ns; - sb = sget(fs_type, kernfs_test_super, kernfs_set_super, flags, info); + sb = sget_userns(fs_type, kernfs_test_super, kernfs_set_super, flags, + &init_user_ns, info); if (IS_ERR(sb) || sb->s_fs_info != info) kfree(info); if (IS_ERR(sb)) -- 1.9.1