summaryrefslogtreecommitdiff
path: root/fs/kernfs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-06-10 21:03:05 +0300
committerEric W. Biederman <ebiederm@xmission.com>2016-06-23 23:41:56 +0300
commit29a517c232d21a717aecea29838aeb07131f6196 (patch)
tree6e49472e6f3efaf11831a4deb82d4e7656702553 /fs/kernfs
parenta001e74cef34d95ede6535ef521011c612657a3a (diff)
downloadlinux-29a517c232d21a717aecea29838aeb07131f6196.tar.xz
kernfs: The cgroup filesystem also benefits from SB_I_NOEXEC
The cgroup filesystem is in the same boat as sysfs. No one ever permits executables of any kind on the cgroup filesystem, and there is no reasonable future case to support executables in the future. Therefore move the setting of SB_I_NOEXEC which makes the code proof against future mistakes of accidentally creating executables from sysfs to kernfs itself. Making the code simpler and covering the sysfs, cgroup, and cgroup2 filesystems. Acked-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/kernfs')
-rw-r--r--fs/kernfs/mount.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index d90d574c15a2..1443df670260 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -152,6 +152,8 @@ static int kernfs_fill_super(struct super_block *sb, unsigned long magic)
struct dentry *root;
info->sb = sb;
+ /* Userspace would break if executables appear on sysfs */
+ sb->s_iflags |= SB_I_NOEXEC;
sb->s_blocksize = PAGE_SIZE;
sb->s_blocksize_bits = PAGE_SHIFT;
sb->s_magic = magic;