Skip to contentSkip to conversation

selinux: fix logic issue with per-file labeling for functionfs

PATCH In review Neill Kapron 2 participants 5 messages Sep 5, 2025 – Sep 7, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: fix logic issue with per-file labeling for functionfs

This patch resolves a logic issue with selinux_set_mnt_opts when selinux_policycap_functionfs_seclabel is enabled. The issue was introduced between v1 and v2 of the original patchset.

Fixes 1b22454bb5e6 ("selinux: enable per-file labeling for functionfs")
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/hooks.c +1 -1
index 333bb6cba25e..0e47b4bb8d40 100644
@@ -745,7 +745,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 	    !strcmp(sb->s_type->name, "pstore") ||
 	    !strcmp(sb->s_type->name, "securityfs") ||
 	    (selinux_policycap_functionfs_seclabel() &&
-	     strcmp(sb->s_type->name, "functionfs")))
+	     !strcmp(sb->s_type->name, "functionfs")))
 		sbsec->flags |= SE_SBGENFS;
 
 	if (!strcmp(sb->s_type->name, "sysfs") ||
Signature · 1 line
2.51.0.355.g5224444f11-goog
maintainer
#1 lore raw
Quoted 10 lines · Neill Kapron

This patch resolves a logic issue with selinux_set_mnt_opts when selinux_policycap_functionfs_seclabel is enabled. The issue was introduced between v1 and v2 of the original patchset.

Fixes 1b22454bb5e6 ("selinux: enable per-file labeling for functionfs")
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

With the original patch sitting at the top of the selinux/dev branch, are you okay if I simply fixup the existing patch by adding the missing '!'?

Quoted 15 lines
security/selinux/hooks.c +1 -2
index 333bb6cba25e..0e47b4bb8d40 100644
@@ -745,7 +745,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
            !strcmp(sb->s_type->name, "pstore") ||
            !strcmp(sb->s_type->name, "securityfs") ||
            (selinux_policycap_functionfs_seclabel() &&
-            strcmp(sb->s_type->name, "functionfs")))
+            !strcmp(sb->s_type->name, "functionfs")))
                sbsec->flags |= SE_SBGENFS;
 
        if (!strcmp(sb->s_type->name, "sysfs") ||
--

2.51.0.355.g5224444f11-goog

Signature · 1 line
paul-moore.com
#2 lore raw
Quoted 5 lines · Paul Moore

With the original patch sitting at the top of the selinux/dev branch, are you okay if I simply fixup the existing patch by adding the missing '!'?

Yes, that is fine by me. I could submit a v4 if you would prefer that.

Sorry for the thrash,
Neill

maintainer
#3 lore raw
Quoted 8 lines · Neill Kapron
Quoted 5 lines · Paul Moore

With the original patch sitting at the top of the selinux/dev branch, are you okay if I simply fixup the existing patch by adding the missing '!'?

Yes, that is fine by me. I could submit a v4 if you would prefer that.

No need for a v4, it's just a single missing '!' and the commit happens to still be at the top of the patch stack. In cases like this it's easier for me to just apply the fix manually.

Fixed the upstream commit and pushed back up to selinux/dev; please take a look and verify that it looks okay to you.

Signature · 1 line
paul-moore.com
#4 lore raw
Quoted 8 lines · Paul Moore

No need for a v4, it's just a single missing '!' and the commit happens to still be at the top of the patch stack. In cases like this it's easier for me to just apply the fix manually.

Fixed the upstream commit and pushed back up to selinux/dev; please take a look and verify that it looks okay to you.

The commit with the fixup looks good to me.

Thanks,
Neill