Skip to contentSkip to conversation

libsepol: Support functionfs_seclabel policycap

PATCH In review Neill Kapron 2 participants 4 messages Aug 28, 2025 – Sep 10, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libsepol: Support functionfs_seclabel policycap

This adds the necessary userspace pieces to support the functionfs_seclabel policycap which enables per-file labels in functionfs and the ability for userspace to apply the labels.

With the policycap disabled, legacy behaviors are maintained and per-file labeling is disallowed.

Changes since v2:
- Sending as separate patches

---
 libsepol/include/sepol/policydb/polcaps.h | 1 +
 libsepol/src/polcaps.c                    | 1 +
 2 files changed, 2 insertions(+)
libsepol/include/sepol/policydb/polcaps.h +1 -0
index 0835ea21..bbaebf1a 100644
@@ -19,6 +19,7 @@ enum {
 	POLICYDB_CAP_NETLINK_XPERM,
 	POLICYDB_CAP_NETIF_WILDCARD,
 	POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+	POLICYDB_CAP_FUNCTIONFS_SECLABEL,
 	__POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -0
index 7ac0ae7c..83eb6143 100644
@@ -18,6 +18,7 @@ static const char * const polcap_names[POLICYDB_CAP_MAX + 1] = {
 	[POLICYDB_CAP_NETLINK_XPERM]			= "netlink_xperm",
 	[POLICYDB_CAP_NETIF_WILDCARD]			= "netif_wildcard",
 	[POLICYDB_CAP_GENFS_SECLABEL_WILDCARD]		= "genfs_seclabel_wildcard",
+	[POLICYDB_CAP_FUNCTIONFS_SECLABEL]		= "functionfs_seclabel",
 };
 
 int sepol_polcap_getnum(const char *name)
Signature · 1 line
2.51.0.318.gd7df087d1a-goog
maintainer
#1 lore raw
Quoted 9 lines · Neill Kapron

This adds the necessary userspace pieces to support the functionfs_seclabel policycap which enables per-file labels in functionfs and the ability for userspace to apply the labels.

With the policycap disabled, legacy behaviors are maintained and per-file labeling is disallowed.

Same caveat here - don't rely on this policy capability bit remaining stable until the kernel patch is merged and de-conflicted with the other recent patches introducing policy capabilities.
And likewise, again doesn't require re-spinning IMHO but the changelog below should go after the "---" so it doesn't get included in the commit message since it becomes irrelevant once the patch is merged. Will wait to Ack this one until the kernel patch is merged.

Quoted 35 lines

Changes since v2:
- Sending as separate patches

---
 libsepol/include/sepol/policydb/polcaps.h | 1 +
 libsepol/src/polcaps.c                    | 1 +
 2 files changed, 2 insertions(+)
libsepol/include/sepol/policydb/polcaps.h +1 -0
index 0835ea21..bbaebf1a 100644
@@ -19,6 +19,7 @@ enum {
        POLICYDB_CAP_NETLINK_XPERM,
        POLICYDB_CAP_NETIF_WILDCARD,
        POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+       POLICYDB_CAP_FUNCTIONFS_SECLABEL,
        __POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -1
index 7ac0ae7c..83eb6143 100644
@@ -18,6 +18,7 @@ static const char * const polcap_names[POLICYDB_CAP_MAX + 1] = {
        [POLICYDB_CAP_NETLINK_XPERM]                    = "netlink_xperm",
        [POLICYDB_CAP_NETIF_WILDCARD]                   = "netif_wildcard",
        [POLICYDB_CAP_GENFS_SECLABEL_WILDCARD]          = "genfs_seclabel_wildcard",
+       [POLICYDB_CAP_FUNCTIONFS_SECLABEL]              = "functionfs_seclabel",
 };
 
 int sepol_polcap_getnum(const char *name)
--

2.51.0.318.gd7df087d1a-goog

maintainer Acked-by on v3 1/1
#2 lore raw
In reply to Neill Kapron
Quoted 9 lines · Neill Kapron

This adds the necessary userspace pieces to support the functionfs_seclabel policycap which enables per-file labels in functionfs and the ability for userspace to apply the labels.

With the policycap disabled, legacy behaviors are maintained and per-file labeling is disallowed.

Quoted 35 lines

Changes since v2:
- Sending as separate patches

---
 libsepol/include/sepol/policydb/polcaps.h | 1 +
 libsepol/src/polcaps.c                    | 1 +
 2 files changed, 2 insertions(+)
libsepol/include/sepol/policydb/polcaps.h +1 -0
index 0835ea21..bbaebf1a 100644
@@ -19,6 +19,7 @@ enum {
        POLICYDB_CAP_NETLINK_XPERM,
        POLICYDB_CAP_NETIF_WILDCARD,
        POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+       POLICYDB_CAP_FUNCTIONFS_SECLABEL,
        __POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -1
index 7ac0ae7c..83eb6143 100644
@@ -18,6 +18,7 @@ static const char * const polcap_names[POLICYDB_CAP_MAX + 1] = {
        [POLICYDB_CAP_NETLINK_XPERM]                    = "netlink_xperm",
        [POLICYDB_CAP_NETIF_WILDCARD]                   = "netif_wildcard",
        [POLICYDB_CAP_GENFS_SECLABEL_WILDCARD]          = "genfs_seclabel_wildcard",
+       [POLICYDB_CAP_FUNCTIONFS_SECLABEL]              = "functionfs_seclabel",
 };
 
 int sepol_polcap_getnum(const char *name)
--

2.51.0.318.gd7df087d1a-goog

maintainer
#3 lore raw
Quoted 7 lines · Stephen Smalley
Quoted 5 lines · Neill Kapron

This adds the necessary userspace pieces to support the functionfs_seclabel policycap which enables per-file labels in functionfs and the ability for userspace to apply the labels.

Quoted 6 lines
Quoted 4 lines

With the policycap disabled, legacy behaviors are maintained and per-file labeling is disallowed.

Thanks, merged.

Quoted 36 lines
Quoted 36 lines

Changes since v2:
- Sending as separate patches

---
 libsepol/include/sepol/policydb/polcaps.h | 1 +
 libsepol/src/polcaps.c                    | 1 +
 2 files changed, 2 insertions(+)
libsepol/include/sepol/policydb/polcaps.h +1 -0
index 0835ea21..bbaebf1a 100644
@@ -19,6 +19,7 @@ enum {
        POLICYDB_CAP_NETLINK_XPERM,
        POLICYDB_CAP_NETIF_WILDCARD,
        POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+       POLICYDB_CAP_FUNCTIONFS_SECLABEL,
        __POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -1
index 7ac0ae7c..83eb6143 100644
@@ -18,6 +18,7 @@ static const char * const polcap_names[POLICYDB_CAP_MAX + 1] = {
        [POLICYDB_CAP_NETLINK_XPERM]                    = "netlink_xperm",
        [POLICYDB_CAP_NETIF_WILDCARD]                   = "netif_wildcard",
        [POLICYDB_CAP_GENFS_SECLABEL_WILDCARD]          = "genfs_seclabel_wildcard",
+       [POLICYDB_CAP_FUNCTIONFS_SECLABEL]              = "functionfs_seclabel",
 };
 
 int sepol_polcap_getnum(const char *name)
--

2.51.0.318.gd7df087d1a-goog