security: selinux: allow per-file labeling for bpffs
authorConnor O'Brien <connoro@google.com>
Fri, 7 Feb 2020 18:01:49 +0000 (10:01 -0800)
committerPaul Moore <paul@paul-moore.com>
Wed, 12 Feb 2020 03:02:54 +0000 (22:02 -0500)
Add support for genfscon per-file labeling of bpffs files. This allows
for separate permissions for different pinned bpf objects, which may
be completely unrelated to each other.

Signed-off-by: Connor O'Brien <connoro@google.com>
Signed-off-by: Steven Moreland <smoreland@google.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c

index 7c37cdb..44f6f4e 100644 (file)
@@ -702,6 +702,7 @@ 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, "binderfs") ||
+           !strcmp(sb->s_type->name, "bpf") ||
            !strcmp(sb->s_type->name, "pstore"))
                sbsec->flags |= SE_SBGENFS;