[PATCH v2 0/4] vfs: if RESOLVE_NO_XDEV passed to openat2, don't *trigger* automounts

Askar Safin <[email protected]> Mon, 25 Aug 2025 18:12:29 +0000
Newsgroups gmane.linux.file-systems,gmane.linux.kernel.autofs
Message-ID <[email protected]>
openat2 had a bug: if we pass RESOLVE_NO_XDEV, then openat2
doesn't traverse through automounts, but may still trigger them.
See this link for full bug report with reproducer:
https://lore.kernel.org/linux-fsdevel/[email protected]/

This patchset fixes the bug.

RESOLVE_NO_XDEV logic hopefully becomes more clear:
now we immediately fail when we cross mountpoints.

I think 4th patch should go to -fixes and stable trees.

I split everything to very small commits to make
everything as bisectable as possible.

Minimal testing was performed. I tested that my original
reproducer doesn't reproduce anymore. And I did boot-test
with localmodconfig in qemu

I'm not very attached to this patchset. I. e. I will not be offended
if someone else will submit different fix for this bug.

v1: https://lore.kernel.org/linux-fsdevel/[email protected]/

v1 -> v2:
- Commit messages
- Comments
- Clarified that 4th patch should go to stable
- Whitespace

Askar Safin (4):
  namei: move cross-device check to traverse_mounts
  namei: remove LOOKUP_NO_XDEV check from handle_mounts
  namei: move cross-device check to __traverse_mounts
  openat2: don't trigger automounts with RESOLVE_NO_XDEV

 fs/namei.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

-- 
2.47.2