Skip procfs symlinks in virtual proc_path resolution#211
Merged
Conversation
Collaborator
Author
jserv
requested changes
Jul 17, 2026
jserv
left a comment
Contributor
There was a problem hiding this comment.
Always enforce rules specified in https://cbea.ms/git-commit/ without leading tags such as fs:.
jserv
reviewed
Jul 17, 2026
To fix fstatfs returning the incorrect magic on open descriptors of procfs magic links and symlinks, exclude paths like /proc/self/exe, /proc/self/cwd, /proc/self/root, /proc/self/fd/N, and task-specific equivalents from resolving to a virtual proc_path stamp. This prevents the guest fd table from recording these entries as part of the emulated procfs, letting fstatfs correctly query the filesystem information of their resolved host file targets. Fix sysprog21#142
Contributor
|
Thank @doanbaotrung for contributing! |
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.
To fix fstatfs returning the incorrect magic on open descriptors of procfs magic links and symlinks, exclude paths like /proc/self/exe, /proc/self/cwd, /proc/self/root, /proc/self/fd/N, and task-specific equivalents from resolving to a virtual proc_path stamp.
This prevents the guest fd table from recording these entries as part of the emulated procfs, letting fstatfs correctly query the filesystem information of their resolved host file targets.
Fix #142
Summary by cubic
Fix statfs/fstatfs to report the correct filesystem type for /proc symlink targets and FDs by skipping virtual
proc_pathstamping and makingstatfsfollow /proc symlinks (with a loop cap). Prevents mislabeling as procfs and fixes incorrectf_type. Fixes #142.Bug Fixes
proc_pathresolution (/proc/self/exe,/proc/self/cwd,/proc/self/root,/proc/self/fd/N, and task variants).statfson these paths now follows the link and reports the target host filesystem;statfson/procand real proc files returnsPROC_SUPER_MAGIC.fstatfson FDs from these paths now reports the target host filesystem.Refactors
proc_intercept_statfs; unified/procstatfs handling with a 40-step symlink-follow limit.dirfdbase path now returnsENOTDIRwhen a non-directory FD has aproc_path.Written for commit d698f05. Summary will update on new commits.