Open squashfs images as the calling user, not as root (kernel backend) - #176
Merged
Merged
Conversation
…th accesses are constrained by the users credentials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes finding #2 of the 2026-09-12 security audit. The setuid
squashfs-mounthelper and the Slurm SPANK hook both opened the user-named image as root with
no check that the user could read it, so any user could mount and read any
squashfs file on the system. The
fusebackend is not affected.The image is now opened with the caller's credentials, and only the loop-device
and
mount(2)syscalls run as root. SinceLOOP_CONFIGUREbinds a descriptorrather than a path, there is no TOCTOU window.
util::privilege.{h,cpp}andutil::unique_fdhold the credentialchanges and carry the open descriptors to the mount.
main()and regains root only forthe unshare and mount. It never touches gids.
dedicated thread via raw syscalls, so slurmstepd stays root. This replaces
the
setegidroot_squash workaround from fix: mount squasfs files on root squashed NFS mounts #135.Behaviour change: an image only root can read, or under a directory the user
cannot traverse, is now refused. Check modes on deployed image stores before
upgrading. Group-readable images now work under Slurm without
--gid.