fix(virtiofs): scope host-edge read-only to directory bind mounts#233
Closed
ndeloof wants to merge 1 commit into
Closed
fix(virtiofs): scope host-edge read-only to directory bind mounts#233ndeloof wants to merge 1 commit into
ndeloof wants to merge 1 commit into
Conversation
A read-only file bind mount shares its *parent* directory via virtio-fs (virtio-fs operates on directories), and that parent typically holds unrelated writable files — the container's own runtime state and stdio fifos. Marking the whole share read-only at the host edge therefore denies writes to those siblings and stalls container start. Restrict host-edge read-only to directory bind mounts, where the share maps exactly to the read-only mount. A read-only file bind mount keeps its read-only guarantee through the guest `ro` mount option preserved in the OCI spec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
883e79c to
501f26a
Compare
Contributor
Author
|
Superseding this with a downstream fix: downstram stops marking its own generated /etc files (resolv.conf, trust-store bundle) read-only, so a read-only file mount no longer makes its shared parent directory read-only at the host edge. That removes the need for this directory-only refinement on the nerdbox side for the immediate use case. Closing for now; can revisit if a general nerdbox-side guard is wanted later. |
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.
Problem
bindMountermarks a virtio-fs share read-only at the host edge whenever the OCI bind mount carries therooption. For a file bind mount this is incorrect: virtio-fs operates on directories, so a file mount is backed by sharing its parent directory. That parent typically contains unrelated writable files — the container's own runtime state and stdio fifos — so flagging the whole share read-only at the host edge denies writes to those siblings and stalls container start.Fix
Only directory bind mounts get host-edge read-only, where the shared device maps exactly to the read-only mount. A read-only file bind mount keeps its read-only guarantee through the guest
romount option that is still preserved in the OCI spec (defense in depth — unchanged behavior for files).Test plan
go build ./...robind mount: writes are rejected at the host edge and cannot be re-enabled from inside the guest.robind mount: container starts normally; sibling runtime files in the shared parent stay writable; the mounted file itself stays read-only via the guest mount.🤖 Generated with Claude Code