Skip to contentSkip to conversation

libsepol: add memfd_class capability

PATCH In review Thiébaud Weksteen 2 participants 6 messages Sep 2, 2025 – Sep 23, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol: add memfd_class capability

memfd_class was declared upstream in [1]. Add it to the list of known capabilities.

[1] https://lore.kernel.org/selinux/[email protected]/

---
 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..1f8e8bdb 100644
@@ -19,6 +19,7 @@ enum {
 	POLICYDB_CAP_NETLINK_XPERM,
 	POLICYDB_CAP_NETIF_WILDCARD,
 	POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+	POLICYDB_CAP_MEMFD_CLASS,
 	__POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -0
index 7ac0ae7c..22f0905f 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_MEMFD_CLASS]			= "memfd_class",
 };
 
 int sepol_polcap_getnum(const char *name)
Signature · 1 line
2.51.0.338.gd7d06c2dae-goog
maintainer
#1 lore raw
Quoted 7 lines · Thiébaud Weksteen

memfd_class was declared upstream in [1]. Add it to the list of known capabilities.

[1] https://lore.kernel.org/selinux/[email protected]/

Just a reminder for the other SELinux userspace maintainers that we need to wait until we see which policy capability ends up being reserved in the upstream kernel before applying this patch. And a reminder of the following longstanding open issue that is relevant, https://github.com/SELinuxProject/selinux/issues/55

Quoted 32 lines
---
 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..1f8e8bdb 100644
@@ -19,6 +19,7 @@ enum {
        POLICYDB_CAP_NETLINK_XPERM,
        POLICYDB_CAP_NETIF_WILDCARD,
        POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+       POLICYDB_CAP_MEMFD_CLASS,
        __POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -1
index 7ac0ae7c..22f0905f 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_MEMFD_CLASS]                      = "memfd_class",
 };
 
 int sepol_polcap_getnum(const char *name)
--

2.51.0.338.gd7d06c2dae-goog

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Thiébaud Weksteen
Quoted 7 lines · Thiébaud Weksteen

memfd_class was declared upstream in [1]. Add it to the list of known capabilities.

[1] https://lore.kernel.org/selinux/[email protected]/

Will re-base on merge.

Quoted 32 lines
---
 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..1f8e8bdb 100644
@@ -19,6 +19,7 @@ enum {
        POLICYDB_CAP_NETLINK_XPERM,
        POLICYDB_CAP_NETIF_WILDCARD,
        POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+       POLICYDB_CAP_MEMFD_CLASS,
        __POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -1
index 7ac0ae7c..22f0905f 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_MEMFD_CLASS]                      = "memfd_class",
 };
 
 int sepol_polcap_getnum(const char *name)
--

2.51.0.338.gd7d06c2dae-goog

maintainer
#3 lore raw
Quoted 6 lines · Stephen Smalley
Quoted 4 lines · Thiébaud Weksteen

memfd_class was declared upstream in [1]. Add it to the list of known capabilities.

Quoted 7 lines
Quoted 3 lines

[1] https://lore.kernel.org/selinux/[email protected]/

Will re-base on merge.

Thanks, now merged - note that the policy capability number changed due to the previous merge of the functionfs_seclabel polcap.

Quoted 33 lines
Quoted 33 lines
---
 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..1f8e8bdb 100644
@@ -19,6 +19,7 @@ enum {
        POLICYDB_CAP_NETLINK_XPERM,
        POLICYDB_CAP_NETIF_WILDCARD,
        POLICYDB_CAP_GENFS_SECLABEL_WILDCARD,
+       POLICYDB_CAP_MEMFD_CLASS,
        __POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -1
index 7ac0ae7c..22f0905f 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_MEMFD_CLASS]                      = "memfd_class",
 };
 
 int sepol_polcap_getnum(const char *name)
--

2.51.0.338.gd7d06c2dae-goog

maintainer
#4 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Thiébaud Weksteen

memfd_class was declared upstream in [1]. Add it to the list of known capabilities.

[1] https://lore.kernel.org/selinux/[email protected]/

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Will re-base on merge.

Thanks, now merged - note that the policy capability number changed due to the previous merge of the functionfs_seclabel polcap.

With apologies, this has now been reverted due to the kernel revert. Happy to re-base on top when/if the kernel patch lands.

maintainer
#5 lore raw
Quoted 18 lines · Stephen Smalley
Quoted 15 lines · Stephen Smalley
Quoted 12 lines · Stephen Smalley
Quoted 7 lines · Thiébaud Weksteen

memfd_class was declared upstream in [1]. Add it to the list of known capabilities.

[1] https://lore.kernel.org/selinux/[email protected]/

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Will re-base on merge.

Thanks, now merged - note that the policy capability number changed due to the previous merge of the functionfs_seclabel polcap.

With apologies, this has now been reverted due to the kernel revert. Happy to re-base on top when/if the kernel patch lands.

Now re-applied, hopefully for good this time.