selinux: enable genfscon labeling for tracefs
authorJeff Vander Stoep <jeffv@google.com>
Tue, 20 Jun 2017 16:35:33 +0000 (09:35 -0700)
committerPaul Moore <paul@paul-moore.com>
Tue, 20 Jun 2017 19:53:34 +0000 (15:53 -0400)
In kernel version 4.1, tracefs was separated from debugfs into its
own filesystem. Prior to this split, files in
/sys/kernel/debug/tracing could be labeled during filesystem
creation using genfscon or later from userspace using setxattr. This
change re-enables support for genfscon labeling.

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c

index 9cc042df10d162c3e61da26cc402cce7f7769e0a..3a06afbd2f6fe9a19fc61961b630995a27059dfb 100644 (file)
@@ -813,6 +813,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
                sbsec->flags |= SE_SBPROC | SE_SBGENFS;
 
        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"))
                sbsec->flags |= SE_SBGENFS;