From c15e19c806be18a4725317402a3f7c255f6b21f1 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Wed, 13 Mar 2024 09:14:46 +0000 Subject: [PATCH] kata-agent: optional bind flag Fixes: #9269 From https://github.com/opencontainers/runtime-spec/blob/main/config.md#mounts type (string, OPTIONAL) The type of the filesystem to be mounted. bind may be only specified in the oci spec options -> flags update r#type The agent will ignore bind mounts if they are only specified in the OCI spec options and not in the flags. Signed-off-by: Zvonko Kaiser --- src/agent/rustjail/src/mount.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/agent/rustjail/src/mount.rs b/src/agent/rustjail/src/mount.rs index b822736dcf..0b80718df3 100644 --- a/src/agent/rustjail/src/mount.rs +++ b/src/agent/rustjail/src/mount.rs @@ -218,6 +218,17 @@ pub fn init_rootfs( )); } + // From https://github.com/opencontainers/runtime-spec/blob/main/config.md#mounts + // type (string, OPTIONAL) The type of the filesystem to be mounted. + // bind may be only specified in the oci spec options -> flags update r#type + let m = &{ + let mut mbind = m.clone(); + if mbind.r#type.is_empty() && flags & MsFlags::MS_BIND == MsFlags::MS_BIND { + mbind.r#type = "bind".to_string(); + } + mbind + }; + if m.r#type == "cgroup" { mount_cgroups(cfd_log, m, rootfs, flags, &data, cpath, mounts)?; } else {