Resolve filesystem operations in container mount namespaces - #830
Open
recrack wants to merge 1 commit into
Open
Conversation
This was referenced Aug 4, 2026
recrack
marked this pull request as ready for review
August 4, 2026 11:33
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.
Summary
Resolve filesystem operations relative to a workload container's init process so operations such as
FITRIMtarget the container's mount namespace instead of vminitd's namespace.FilesystemOperationRequest/proc/<pid>directory when the process startsopenat2(RESOLVE_IN_ROOT | RESOLVE_NO_MAGICLINKS)Motivation
vminitdcurrently resolves filesystem-operation paths in its own mount namespace. A workload's root filesystem can be addressed there, but mounts created in the workload container's mount namespace, including named volumes, cannot. This prevents operations such as filesystem trim from reaching those filesystems.Passing only a numeric PID or concatenating
/proc/<pid>/rootwith a guest-controlled path would introduce traversal, procfs magic-link, and PID-reuse risks. This change instead carries the workload identity through the RPC, looks up the managed init process, and resolves the target through a process-root descriptor captured at process start.Closes #829.
Related to apple/container#1763 and apple/container#1949.
Testing
make fmtmake update-licenseshawkeye checkgit diff --check/usr/bin/swift test --filter LinuxContainerTests/filesystemOperation/usr/bin/swift test --filter LinuxContainerTests/podFilesystemOperationTargetsContainerMountNamespacemake linux-testVminitCoreTestsCAP_SYS_ADMINmake linux-build LIBC=allmake containerization && make init-imagevminit:latestwas createdapple/containerclean exercise with this vminit imageSecurity considerations
RESOLVE_IN_ROOTto scope resolution to the captured container rootRESOLVE_NO_MAGICLINKSto prevent procfs magic-link escapes while preserving normal container symlinks/proc/<pid>before process execution is exposed and clears it when the process exits