From 792678e85ceb659033252f13ab92d502d89d9bab Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 24 Sep 2025 02:04:31 +0000 Subject: [PATCH 1/3] build: Incorporate rust-vmm crates in dev-dependencies rust-vmm crates in `dev-dependencies` were left behind, make those to reference versions specified in workspace as well. Signed-off-by: Ruoqing He --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7fba40f7..506a8779 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,8 +61,8 @@ tokio-uring = { version = "0.4.0", optional = true } [dev-dependencies] tokio-test = "0.4.2" -vmm-sys-util = "0.12.1" -vm-memory = { version = "0.14.1", features = ["backend-mmap", "backend-bitmap"] } +vmm-sys-util = { workspace = true } +vm-memory = { workspace = true, features = ["backend-mmap", "backend-bitmap"] } [features] default = ["fusedev"] From e9c30951b3670f5e88e9439c76ab047bab6837b4 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 24 Sep 2025 08:08:07 +0000 Subject: [PATCH 2/3] build: Bump rust-vmm crates The rust-vmm crates are out-of-date and has security problems, bump to catch up the security fixes. Signed-off-by: Ruoqing He --- Cargo.toml | 12 +++---- src/transport/fs_cache_req_handler.rs | 50 --------------------------- 2 files changed, 6 insertions(+), 56 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 506a8779..aa847a6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,11 +24,11 @@ members = [ [workspace.dependencies] # rust-vmm crates -vhost = "0.11.0" -virtio-bindings = "=0.2.4" -virtio-queue = "0.12.0" -vm-memory = "0.14.1" -vmm-sys-util = "0.12.1" +vhost = "0.14.0" +virtio-bindings = "0.2.6" +virtio-queue = "0.16.0" +vm-memory = "0.16.1" +vmm-sys-util = "0.14.0" [dependencies] arc-swap = "1.5" @@ -65,7 +65,7 @@ vmm-sys-util = { workspace = true } vm-memory = { workspace = true, features = ["backend-mmap", "backend-bitmap"] } [features] -default = ["fusedev"] +default = ["vhost-user-fs"] async-io = [ "async-trait", "tokio-uring", diff --git a/src/transport/fs_cache_req_handler.rs b/src/transport/fs_cache_req_handler.rs index 8c4595e3..787a6687 100644 --- a/src/transport/fs_cache_req_handler.rs +++ b/src/transport/fs_cache_req_handler.rs @@ -14,16 +14,7 @@ mod virtiofs { use std::io; use std::os::unix::io::RawFd; - #[cfg(feature = "vhost-user-fs")] - use vhost::vhost_user::message::{ - VhostUserFSBackendMsg, VhostUserFSBackendMsgFlags, VHOST_USER_FS_BACKEND_ENTRIES, - }; - #[cfg(feature = "vhost-user-fs")] - use vhost::vhost_user::{Backend, VhostUserFrontendReqHandler}; - use crate::abi::virtio_fs::RemovemappingOne; - #[cfg(feature = "vhost-user-fs")] - use crate::abi::virtio_fs::SetupmappingFlags; /// Trait to support virtio-fs DAX Window operations. /// @@ -52,45 +43,4 @@ mod virtiofs { /// Remove those mappings that provide the access to file data. fn unmap(&mut self, requests: Vec) -> io::Result<()>; } - - #[cfg(feature = "vhost-user-fs")] - impl FsCacheReqHandler for Backend { - fn map( - &mut self, - foffset: u64, - moffset: u64, - len: u64, - flags: u64, - fd: RawFd, - ) -> io::Result<()> { - let mut msg: VhostUserFSBackendMsg = Default::default(); - msg.fd_offset[0] = foffset; - msg.cache_offset[0] = moffset; - msg.len[0] = len; - msg.flags[0] = if (flags & SetupmappingFlags::WRITE.bits()) != 0 { - VhostUserFSBackendMsgFlags::MAP_W | VhostUserFSBackendMsgFlags::MAP_R - } else { - VhostUserFSBackendMsgFlags::MAP_R - }; - - self.fs_backend_map(&msg, &fd)?; - - Ok(()) - } - - fn unmap(&mut self, requests: Vec) -> io::Result<()> { - for chunk in requests.chunks(VHOST_USER_FS_BACKEND_ENTRIES) { - let mut msg: VhostUserFSBackendMsg = Default::default(); - - for (ind, req) in chunk.iter().enumerate() { - msg.len[ind] = req.len; - msg.cache_offset[ind] = req.moffset; - } - - self.fs_backend_unmap(&msg)?; - } - - Ok(()) - } - } } From 0b9e9ef269231cde6585d6840f39112d0e48a626 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 24 Sep 2025 08:15:31 +0000 Subject: [PATCH 3/3] build: Remove virtio-bindings Signed-off-by: Ruoqing He --- Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aa847a6a..0f0fbef1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ members = [ [workspace.dependencies] # rust-vmm crates vhost = "0.14.0" -virtio-bindings = "0.2.6" virtio-queue = "0.16.0" vm-memory = "0.16.1" vmm-sys-util = "0.14.0" @@ -46,7 +45,6 @@ tokio = { version = "1", optional = true } tokio-uring = { version = "0.4.0", optional = true } vmm-sys-util = { workspace = true, optional = true } vm-memory = { workspace = true, features = ["backend-mmap"] } -virtio-bindings = { workspace = true, optional = true } virtio-queue = { workspace = true, optional = true } vhost = { workspace = true, features = ["vhost-user","vhost-user-backend"], optional = true } versionize_derive = { version = "0.1.6", optional = true }