Skip to content

feat(mount): add MS_NOSYMFOLLOW to MsFlags - #2810

Open
jzuber4 wants to merge 1 commit into
nix-rust:masterfrom
jzuber4:add-ms-nosymfollow
Open

feat(mount): add MS_NOSYMFOLLOW to MsFlags#2810
jzuber4 wants to merge 1 commit into
nix-rust:masterfrom
jzuber4:add-ms-nosymfollow

Conversation

@jzuber4

@jzuber4 jzuber4 commented Aug 13, 2026

Copy link
Copy Markdown

What does this PR do

Adds the MS_NOSYMFOLLOW flag to MsFlags in the mount module on Linux and
Android.

MS_NOSYMFOLLOW (bit 0x100) was added to the kernel in Linux 5.10. When
passed to mount(2), it forbids following symbolic links during path
resolution on the mounted filesystem. nix did not expose it, so callers that
need 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 libc as libc::MS_NOSYMFOLLOW since
0.2.186, which is nix's current minimum libc requirement, so this needs no
dependency bump. The flag is placed in kernel bit order, between MS_DIRSYNC
(0x80) and MS_NOATIME (0x400).

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

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
jzuber4 force-pushed the add-ms-nosymfollow branch from f097bbc to 68a8aa0 Compare August 13, 2026 12:21
@jzuber4

jzuber4 commented Aug 13, 2026

Copy link
Copy Markdown
Author

Heads up for reviewers: the red minver check here is not caused by this PR. It's a pre-existing breakage on master (the cfg_aliases 0.2.1 build-dependency floor no longer compiles under -Zdirect-minimal-versions), fixed in #2812. Once #2812 lands I'll rebase this PR onto the updated master and minver will go green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant