From ea5de19fad3f62889899c0d89d08b8b73dfa75da Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Wed, 14 May 2025 19:12:23 +0530 Subject: [PATCH] fix: selinux detection Fix SELinux detection. Fixes: #10965 Signed-off-by: Noel Georgi --- internal/pkg/selinux/selinux.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/pkg/selinux/selinux.go b/internal/pkg/selinux/selinux.go index de6a1be45..c45b7acf1 100644 --- a/internal/pkg/selinux/selinux.go +++ b/internal/pkg/selinux/selinux.go @@ -34,7 +34,13 @@ var IsEnabled = sync.OnceValue(func() bool { val := procfs.ProcCmdline().Get(constants.KernelParamSELinux).First() - return val != nil && *val == "1" + var selinuxFSPresent bool + + if _, err := os.Stat("/sys/fs/selinux"); err == nil { + selinuxFSPresent = true + } + + return val != nil && *val == "1" && selinuxFSPresent }) // IsEnforcing checks if SELinux is enabled and the mode should be enforcing.