feat(mount): add MS_NOSYMFOLLOW to MsFlags - #2810
Open
jzuber4 wants to merge 1 commit into
Open
Conversation
Expose the `MS_NOSYMFOLLOW` mount(2) flag (bit 0x100, added in Linux 5.10) on Linux and Android. It is already provided by libc (>= 0.2.186, nix's current minimum), so no dependency bump is needed. Without it, callers wanting to forbid symlink resolution on a mount must inject the raw bit via `MsFlags::from_bits_unchecked`, which is unsafe and easy to get wrong.
jzuber4
force-pushed
the
add-ms-nosymfollow
branch
from
August 13, 2026 12:21
f097bbc to
68a8aa0
Compare
Author
|
Heads up for reviewers: the red |
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.
What does this PR do
Adds the
MS_NOSYMFOLLOWflag toMsFlagsin themountmodule on Linux andAndroid.
MS_NOSYMFOLLOW(bit0x100) was added to the kernel in Linux 5.10. Whenpassed to
mount(2), it forbids following symbolic links during pathresolution on the mounted filesystem.
nixdid not expose it, so callers thatneed it currently have to reach for
unsafe { MsFlags::from_bits_unchecked(0x100) }and hard-code the raw bit themselves.
The constant is already provided by
libcaslibc::MS_NOSYMFOLLOWsince0.2.186, which isnix's current minimumlibcrequirement, so this needs nodependency bump. The flag is placed in kernel bit order, between
MS_DIRSYNC(
0x80) andMS_NOATIME(0x400).Checklist:
CONTRIBUTING.md