Skip to contentSkip to conversation

apparmor: Make sysctl table const

PATCH New Ricardo B. Marliere 1 participant 1 message Jan 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apparmor: Make sysctl table const

Since commit 7abc9b53bd51 ("sysctl: allow registration of const struct ctl_table"), the sysctl registration API allows for struct ctl_table to be in read-only memory. Move apparmor_sysctl_table to be declared at build time, instead of having to be dynamically allocated at boot time.

---
 security/apparmor/lsm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/lsm.c +1 -1
index 0b4f7e2e4135503f0c78a050e82adb4ff853e9f4..93c7fcd875f764feee7fca6ac302e31ea081d18c 100644
@@ -2205,7 +2205,7 @@ static int apparmor_dointvec(const struct ctl_table *table, int write,
 	return proc_dointvec(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table apparmor_sysctl_table[] = {
+static const struct ctl_table apparmor_sysctl_table[] = {
 #ifdef CONFIG_USER_NS
 	{
 		.procname       = "unprivileged_userns_apparmor_policy",

---
base-commit: e6b087676954e36a7b1ed51249362bb499f8c1c2
change-id: 20250123-sysctl_const-jj-1cdba6ab00ae

Best regards,

Signature · 1 line
Ricardo B. Marliere <[email protected]>