Skip to content

Commit

Permalink
fix: mount selinuxfs only when SELinux is enabled
Browse files Browse the repository at this point in the history
Having selinuxfs mounted might confuse some software, as conventional Linux systems do not have selinuxfs mounted when SELinux is disabled and no policy is loaded.

Fixes #10083

Signed-off-by: Dmitry Sharshakov <[email protected]>
  • Loading branch information
dsseng authored and DmitriyMV committed Jan 5, 2025
1 parent 5ccbf4b commit ae6d065
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/pkg/mount/v2/pseudo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"golang.org/x/sys/unix"

"github.com/siderolabs/talos/internal/pkg/selinux"
"github.com/siderolabs/talos/pkg/machinery/constants"
)

Expand Down Expand Up @@ -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)),
)
Expand Down

0 comments on commit ae6d065

Please sign in to comment.