selinux: allow per-file labeling for cgroupfs
authorAntonio Murdaca <runcom@redhat.com>
Thu, 9 Feb 2017 16:02:42 +0000 (17:02 +0100)
committerPaul Moore <paul@paul-moore.com>
Tue, 22 Aug 2017 19:38:18 +0000 (15:38 -0400)
This patch allows genfscon per-file labeling for cgroupfs. For instance,
this allows to label the "release_agent" file within each
cgroup mount and limit writes to it.

Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
[PM: subject line and merge tweaks]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c

index 2bd7b824b7f592578ea9a0d7ca5ee68ff33411cd..f803fdcde9cf6146ebff7bb83efe2ede001fa6c5 100644 (file)
@@ -815,7 +815,9 @@ static int selinux_set_mnt_opts(struct super_block *sb,
        if (!strcmp(sb->s_type->name, "debugfs") ||
            !strcmp(sb->s_type->name, "tracefs") ||
            !strcmp(sb->s_type->name, "sysfs") ||
-           !strcmp(sb->s_type->name, "pstore"))
+           !strcmp(sb->s_type->name, "pstore") ||
+           !strcmp(sb->s_type->name, "cgroup") ||
+           !strcmp(sb->s_type->name, "cgroup2"))
                sbsec->flags |= SE_SBGENFS;
 
        if (!sbsec->behavior) {