diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2016-06-09 17:06:06 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2016-06-23 16:41:46 -0400 |
commit | 8654df4e2ac9704905198d63845554c2ddf6a93f (patch) | |
tree | 80c18b034fecf8e5754945f9e31ad2a807386907 /fs/sysfs | |
parent | 695e9df010e40f407f4830dc11d53dce957710ba (diff) |
mnt: Refactor fs_fully_visible into mount_too_revealing
Replace the call of fs_fully_visible in do_new_mount from before the
new superblock is allocated with a call of mount_too_revealing after
the superblock is allocated. This winds up being a much better location
for maintainability of the code.
The first change this enables is the replacement of FS_USERNS_VISIBLE
with SB_I_USERNS_VISIBLE. Moving the flag from struct filesystem_type
to sb_iflags on the superblock.
Unfortunately mount_too_revealing fundamentally needs to touch
mnt_flags adding several MNT_LOCKED_XXX flags at the appropriate
times. If the mnt_flags did not need to be touched the code
could be easily moved into the filesystem specific mount code.
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/mount.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index f3db82071cfb..f31e36994dfb 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -42,7 +42,7 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, | |||
42 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); | 42 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); |
43 | else if (new_sb) | 43 | else if (new_sb) |
44 | /* Userspace would break if executables appear on sysfs */ | 44 | /* Userspace would break if executables appear on sysfs */ |
45 | root->d_sb->s_iflags |= SB_I_NOEXEC; | 45 | root->d_sb->s_iflags |= SB_I_USERNS_VISIBLE | SB_I_NOEXEC; |
46 | 46 | ||
47 | return root; | 47 | return root; |
48 | } | 48 | } |
@@ -59,7 +59,7 @@ static struct file_system_type sysfs_fs_type = { | |||
59 | .name = "sysfs", | 59 | .name = "sysfs", |
60 | .mount = sysfs_mount, | 60 | .mount = sysfs_mount, |
61 | .kill_sb = sysfs_kill_sb, | 61 | .kill_sb = sysfs_kill_sb, |
62 | .fs_flags = FS_USERNS_VISIBLE | FS_USERNS_MOUNT, | 62 | .fs_flags = FS_USERNS_MOUNT, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | int __init sysfs_init(void) | 65 | int __init sysfs_init(void) |