All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selinux: enable per-file labeling for functionfs
@ 2025-08-20 21:23 Neill Kapron
  2025-08-21 12:59 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Neill Kapron @ 2025-08-20 21:23 UTC (permalink / raw)
  To: Paul Moore, Stephen Smalley, Ondrej Mosnacek
  Cc: Neill Kapron, kernel-team, selinux, linux-kernel

This patch adds support for genfscon per-file labeling of functionfs
files as well as support for userspace to apply labels after new
functionfs endpoints are created.

This allows for separate labels and therefore access control on a
per-endpoint basis. An example use case would be for the default
endpoint EP0 used as a restricted control endpoint, and additional
usb endpoints to be used by other more permissive domains.

It should be noted that if there are multiple functionfs mounts on a
system, genfs file labels will apply to all mounts, and therefore will not
likely be as useful as the userspace relabeling portion of this patch -
the addition to selinux_is_genfs_special_handling().

Signed-off-by: Neill Kapron <nkapron@google.com>
---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e474cd7398ef..54b82c814b4d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -474,6 +474,7 @@ static int selinux_is_genfs_special_handling(struct super_block *sb)
 		!strcmp(sb->s_type->name, "debugfs") ||
 		!strcmp(sb->s_type->name, "tracefs") ||
 		!strcmp(sb->s_type->name, "rootfs") ||
+		!strcmp(sb->s_type->name, "functionfs") ||
 		(selinux_policycap_cgroupseclabel() &&
 		 (!strcmp(sb->s_type->name, "cgroup") ||
 		  !strcmp(sb->s_type->name, "cgroup2")));
@@ -741,6 +742,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 	    !strcmp(sb->s_type->name, "binder") ||
 	    !strcmp(sb->s_type->name, "bpf") ||
 	    !strcmp(sb->s_type->name, "pstore") ||
+	    !strcmp(sb->s_type->name, "functionfs") ||
 	    !strcmp(sb->s_type->name, "securityfs"))
 		sbsec->flags |= SE_SBGENFS;
 
-- 
2.51.0.261.g7ce5a0a67e-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-21 22:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 21:23 [PATCH] selinux: enable per-file labeling for functionfs Neill Kapron
2025-08-21 12:59 ` Stephen Smalley
2025-08-21 13:03   ` Stephen Smalley
2025-08-21 22:33     ` Neill Kapron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.