From d23d9ec02ca434cbbb4c8a0b56f02471571b66ad Mon Sep 17 00:00:00 2001 From: Changyuan Lyu Date: Fri, 2 Jan 2026 14:52:23 -0800 Subject: [PATCH 1/2] fix(vu): correctly handle 128-bit device features The vhost-user protocol requires 64-bit device features, but the virtio spec allows 128. This commit truncates features to 64 bits before sending, fixing a bug where all 128 bits were sent, causing feature negotiation to fail. Fixes: 128153e1e017 ("fix(virtio): extend virtio feature to 128 bits") Signed-off-by: Changyuan Lyu --- alioth/src/virtio/vu/backend.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alioth/src/virtio/vu/backend.rs b/alioth/src/virtio/vu/backend.rs index 7f916b2a..0a5c744f 100644 --- a/alioth/src/virtio/vu/backend.rs +++ b/alioth/src/virtio/vu/backend.rs @@ -283,7 +283,7 @@ impl VuBackend { } (VuFrontMsg::GET_FEATURES, 0) => { let feature = self.dev.device_feature | VirtioFeature::VHOST_PROTOCOL.bits(); - self.session.reply(req, &feature, &[])?; + self.session.reply(req, &(feature as u64), &[])?; msg.flag.set_need_reply(false); log::debug!("{name}: get device feature: {feature:#x}"); } From e8619eac2b8824b1a9311ac88f1ad7c7c7420103 Mon Sep 17 00:00:00 2001 From: Changyuan Lyu Date: Fri, 2 Jan 2026 16:39:29 -0800 Subject: [PATCH 2/2] fix(vu): serve only one vmm at one time A VirtIO device generally needs exclusive access to specific resources on the host. Creating multiple devices from the same config to serve multiple VMs simultaneously could lead to resource contention. Especially, commit de79b5f95853 made device creation ahead of connection acceptance, and failed virtio-net devices, because when 1 virtio-net device is running, another virtio-net device is created, and the latter opens the same tap again, interfering with the first device's IO. Fixes: de79b5f95853 ("fix(vu): create devices before accepting connections") Signed-off-by: Changyuan Lyu --- alioth-cli/src/vu.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/alioth-cli/src/vu.rs b/alioth-cli/src/vu.rs index 79b7f555..72226e0a 100644 --- a/alioth-cli/src/vu.rs +++ b/alioth-cli/src/vu.rs @@ -16,7 +16,6 @@ use std::marker::PhantomData; use std::os::unix::net::UnixListener; use std::path::Path; use std::sync::Arc; -use std::thread::spawn; use alioth::errors::{DebugTrace, trace_error}; use alioth::mem::mapped::RamBus; @@ -142,7 +141,7 @@ pub fn start(args: VuArgs) -> Result<(), Error> { }?; let (conn, _) = listener.accept().context(error::Accept)?; let backend = VuBackend::new(conn, dev, memory).context(error::CreateVu)?; - spawn(move || run_backend(backend)); + run_backend(backend); index = index.wrapping_add(1); } }