Skip to contentSkip to conversation

security: selinux: allow per-file labeling for bpffs

PATCH Applied Steven Moreland 3 participants 3 messages Feb 7, 2020 – Feb 12, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 security: selinux: allow per-file labeling for bpffs

From: Connor O'Brien <[email protected]>

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.

---
 security/selinux/hooks.c | 1 +
 1 file changed, 1 insertion(+)
security/selinux/hooks.c +1 -0
index d9e8b2131a65..18f8cd47729c 100644
@@ -699,6 +699,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;
 
Signature · 4 lines
2.25.0.341.g760bfbb309-goog

v2 -> v3
- on selinux next branch (instead of master)
Acked-by on v3 1/1
#1 lore raw
Quoted 8 lines · Steven Moreland

From: Connor O'Brien <[email protected]>

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.

Quoted 17 lines
---
  security/selinux/hooks.c | 1 +
  1 file changed, 1 insertion(+)
security/selinux/hooks.c +1 -0
index d9e8b2131a65..18f8cd47729c 100644
@@ -699,6 +699,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;
 
maintainer Applied
#2 lore raw
In reply to Steven Moreland
Quoted 7 lines · Steven Moreland

From: Connor O'Brien <[email protected]>

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.

Quoted 5 lines
---
 security/selinux/hooks.c | 1 +
 1 file changed, 1 insertion(+)

Merged into selinux/next, thanks.

Signature · 2 lines
paul moore
www.paul-moore.com