Replace the manual handling of mounts with the contianerd's mount package#840
Draft
cmainas wants to merge 4 commits into
Draft
Replace the manual handling of mounts with the contianerd's mount package#840cmainas wants to merge 4 commits into
cmainas wants to merge 4 commits into
Conversation
Gather all the mounts for the monitor execution environment and the contianer in a single list which is later given as an argument in applyMOunts to perform all the necessary mounts. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Similarly with mounts, gather all devices in a single slice and then recreate them inside the monitor's execution environment. The only exception is vAccel related devices. We need to handle the case of vAccel separately for the libcontainer migration. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Move the logic that gathers all needed devices and mounts for monitor execution environment in InitialSetup during "urunc create" and then write the information to a file (monitor.json) which Exec will read and apply the mounts, plus create the devices. THis is necessary for the libcontainer refactor. One important note, we always include the /dev/net/tun device from "urunc create" because ein that phase we have no information about the networking of the container. Therefore, we include the device and then let Exec (which is part of "urunc reexec" and CNI hooks have been executed) to choose if it will create or not the device. The fact that we now unmount the block-based mounts in the create phase also has the side effect that we mess up with the mount of someone else's. These mounts do not belong to urunc and we should restore them back. Furthermore, as shown from the CI testing, block-based mounts which are backed from a disk file (e.g. a custom made ext2 file image) are mounted as loop devices and hence unmounting them might remove the loop device. For that reason, we unset the autoclear flag of the loop device to ensure that the loop device will remain and we will be able to attach it later in the sandbox. We bring back the original flag during cleanup. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Replace all the manual handling of mounts, like options handling mounting, etc. with the mount package from containerd. Furthermore, use secureJoin from runc to properly handle file path koins with symlinks and relative paths. One thing to note is that containerd's mount package does not handle correctly the mount propagation flags and therefore, we separate these flags and set them manually. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
cmainas
force-pushed
the
feat_containerd_mount_secure_join
branch
from
July 20, 2026 19:46
d47cd30 to
7add7b8
Compare
✅ Deploy Preview for urunc canceled.
|
✅ Deploy Preview for urunc canceled.
|
4 tasks
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
Replace all the manual handling of mounts, like options handling mounting, etc. with the mount package from containerd. Furthermore,
usesecureJoin` from runc to properly handle file path koins with symlinks and relative paths.One thing to note is that containerd's mount package does not handle correctly the mount propagation flags and therefore, we separate these flags and set them manually.
Related issues
How was this tested?
with e2e tests
LLM usage
Opus 4.8 to update all calls for mounts
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).