From f3c8ef9200ed7f584755508ccb539e92e343f4f3 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Fri, 30 May 2025 16:06:55 +0800 Subject: [PATCH] kata-types: Support disabled sharefs with config of shared_fs = "none" For CoCo, shared_fs is prohibited as we cannot guarantee the security of guest/host sharing. Therefore, this PR enables administrators to configure shared_fs = "none" via the configuration.toml file, thereby enforcing the disablement of sharing. Fixes #10677 Signed-off-by: alex.lyn --- src/libs/kata-types/src/config/hypervisor/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libs/kata-types/src/config/hypervisor/mod.rs b/src/libs/kata-types/src/config/hypervisor/mod.rs index b5b0a26251..d55cda24f6 100644 --- a/src/libs/kata-types/src/config/hypervisor/mod.rs +++ b/src/libs/kata-types/src/config/hypervisor/mod.rs @@ -65,6 +65,7 @@ pub const VIRTIO_PMEM: &str = "virtio-pmem"; mod firecracker; pub use self::firecracker::{FirecrackerConfig, HYPERVISOR_NAME_FIRECRACKER}; +const NO_VIRTIO_FS: &str = "none"; const VIRTIO_9P: &str = "virtio-9p"; const VIRTIO_FS: &str = "virtio-fs"; const VIRTIO_FS_INLINE: &str = "inline-virtio-fs"; @@ -932,6 +933,7 @@ pub struct SharedFsInfo { /// Shared file system type: /// - virtio-fs (default) /// - virtio-9p` + /// - none pub shared_fs: Option, /// Path to vhost-user-fs daemon. @@ -981,6 +983,11 @@ pub struct SharedFsInfo { impl SharedFsInfo { /// Adjust the configuration information after loading from configuration file. pub fn adjust_config(&mut self) -> Result<()> { + if self.shared_fs.as_deref() == Some(NO_VIRTIO_FS) { + self.shared_fs = None; + return Ok(()); + } + if self.shared_fs.as_deref() == Some("") { self.shared_fs = Some(default::DEFAULT_SHARED_FS_TYPE.to_string()); }