Skip to content

Replace the manual handling of mounts with the contianerd's mount package#840

Draft
cmainas wants to merge 4 commits into
mainfrom
feat_containerd_mount_secure_join
Draft

Replace the manual handling of mounts with the contianerd's mount package#840
cmainas wants to merge 4 commits into
mainfrom
feat_containerd_mount_secure_join

Conversation

@cmainas

@cmainas cmainas commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

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.

Related issues

How was this tested?

with e2e tests

LLM usage

Opus 4.8 to update all calls for mounts

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

cmainas added 4 commits July 14, 2026 14:11
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
cmainas force-pushed the feat_containerd_mount_secure_join branch from d47cd30 to 7add7b8 Compare July 20, 2026 19:46
@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit d47cd30
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a5e7b1ed3502900072330a4

@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 7add7b8
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a5e7b1e07c68e000936fd8f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace all manually handled mounts with containerd's mount helper

1 participant