Repository navigation
Conversation
An OCI mount is a bind mount when its options include "bind" or "rbind"; its Type is then a dummy that runtimes such as runc ignore. Docker sets it to "bind", but containerd and nerdctl emit volumes (`nerdctl run -v host:/data`) with Type "none". urunc only checked for Type "bind", so such volumes were dropped everywhere bind mounts are filtered: they never reached the shared rootfs of a virtiofs/9p guest, were not copied into a block rootfs or an initrd, and were not remounted with their VFS flags. Add isBindMount, which follows the runtime spec and looks only at the options, and use it in every such check (mount application, shared-fs and block filtering). The initrd package no longer filters mounts itself; its caller passes it only the bind mounts. Also a mount spelled only by its Type, e.g. Type "bind" without a bind option, is not a bind mount and is dropped like other unsupported mounts, so make the e2e ctr helper pass the rbind option that `ctr --mount type=bind` omits. Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
Rootless runtimes replace the container's sysfs mount with an rbind of the host's /sys, e.g. with --net=host, since they cannot mount a fresh sysfs. Now that such Type "none" binds are recognised, this mount would end up in the rootfs shared with a virtiofs/9p guest, exposing the host's sysfs to it and, through the file server, letting the guest write host kernel knobs. On the block and initrd paths, single-file binds from /proc or /sys would also copy host state into the guest. Add onlyBindMounts as the single place that selects the spec mounts passed to the guest: the bind mounts, minus those whose source resides on a host kernel filesystem (sysfs, procfs, cgroupfs, securityfs, debugfs, tracefs, bpffs, efivarfs, pstore, binfmt_misc and nsfs), detected through statfs. Skipped mounts are logged. Use it for the shared-fs, initrd and block (file copies and volumes) paths. The guest has its own kernel and its own instances of these filesystems. A bind mount whose source cannot be statfs'd, e.g. because it does not exist, now fails container creation on every path. Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
For a block rootfs, copyMountfiles copies the source of each bind mount into the rootfs with fileFromHost, which only refused directories. Any other special file broke container creation: opening a socket fails, opening a FIFO blocks forever and reading a device such as /dev/urandom never ends, filling the rootfs. Replace ErrCopyDir with ErrNotRegularFile, which fileFromHost returns for anything that is not a regular file, before opening it, and skip such mounts in copyMountfiles as directories already were. This matches the initrd path, which already copies only regular files. Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
cmainas
force-pushed
the
fix/bind_mounts_type_none
branch
3 times, most recently
from
October 26, 2026 20:55
d139be7 to
d3251f1
Compare
cmainas
marked this pull request as ready for review
October 27, 2026 12:55
This branch has not been deployed
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.
Description
containerd and nerdctl spell volumes as
{"type": "none", "options": ["rbind", ...]}.urunc only acceptedtype: "bind", so such volumes never reached the guest.isBindMountnow follows the OCI runtime spec and runc: a mount is a bind mount if its options includebindorrbind,regardless of its type. A mount withtype: "bind"but no such option is dropped, so the e2e ctr helper now passesoptions=rbind./sys, which would otherwise end up in the virtiofs/9p share.onlyBindMountsskips, with a warning, bind mounts whose source is on sysfs, procfs, cgroupfs or another kernel filesystem, for every rootfs type.At last, a bind mount whose source does not exist now fails container creation for every rootfs type.
Related issues
How was this tested?
With e2e tests
LLM usage
Opus 5.5
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).