diff --git a/internal/pkg/mount/v2/pseudo.go b/internal/pkg/mount/v2/pseudo.go index 566761fdd2..0ecd6ced99 100644 --- a/internal/pkg/mount/v2/pseudo.go +++ b/internal/pkg/mount/v2/pseudo.go @@ -9,6 +9,7 @@ import ( "golang.org/x/sys/unix" + "github.com/siderolabs/talos/internal/pkg/selinux" "github.com/siderolabs/talos/pkg/machinery/constants" ) @@ -49,8 +50,8 @@ func PseudoSubMountPoints() Points { ) } - if _, err := os.Stat("/sys/fs/selinux"); err == nil { - // mount selinuxfs if it exists + if selinux.IsEnabled() { + // mount selinuxfs if it is enabled, which implies SELinux is the major LSM points = append(points, NewPoint("selinuxfs", "/sys/fs/selinux", "selinuxfs", WithFlags(unix.MS_NOSUID|unix.MS_NOEXEC|unix.MS_RELATIME)), )