Repository navigation
Description
Summary
fuse::Session::send_max_size enforces with assert!(data.len() <= max_size as usize) that a filesystem's data reply does not exceed the guest-requested byte count. Because both dev and release profiles configure panic = 'abort', any fuse::Fuse implementation that returns more bytes than requested in read, read_dir, read_dir_plus, get_xattr, or list_xattr aborts the entire VMM process instead of failing the FUSE request with an error reply. Found by formal verification.
Root Cause
In vm/devices/support/fs/fuse/src/session.rs, Session::send_max_size uses an unconditional assert! to validate the length of the Vec<u8> returned by the Fuse trait implementation against the guest's max_size: u32:
/// Send a reply, validating it doesn't exceed the requested size.
///
/// If it exceeds the maximum size, this causes a panic because that's a bug in the file system.
fn send_max_size(
sender: &mut impl ReplySender,
unique: u64,
data: &[u8],
max_size: u32,
) -> Result<(), OperationError> {
assert!(data.len() <= max_size as usize);
sender.send_data(unique, data)?;
Ok(())
}Session::dispatch_helper calls Self::send_max_size for Read (L204-L207), GetXAttr (L245-L247), ListXAttr (L260-L262), ReadDir (L280-L283), and ReadDirPlus (L373-L376). Meanwhile, the corresponding public Fuse trait methods return lx::Result<Vec<u8>> without documenting or enforcing an upper bound in the return type, whereas FuseOperation::Ioctl in the same dispatcher (L334-L336) already rejects an oversized buffer gracefully with Err(lx::Error::EINVAL.into()).
Consequence
OpenVMM sets panic = 'abort' in both [profile.dev] and [profile.release] (Cargo.toml). If a custom or future fuse::Fuse backend passed to fuse::Session::new or virtiofs::VirtioFsDevice::new returns a payload even one byte larger than arg.size, the session dispatcher aborts the entire VMM process rather than failing the offending FUSE request. OpenVMM's built-in VirtioFs backend sizes its read, xattr, and directory buffers from the guest's size parameter and does not trigger this panic, making this a fuse::Session API hardening issue.
Reproduction
Implement fuse::Fuse with read returning Ok(vec![0; arg.size as usize + 1]), initialize a fuse::Session with FUSE_INIT, and dispatch a FUSE_READ request with size = 4096. On commit 9d64daad3cbe14fb0591081b73c6c9648e18d0fb, dispatching the request panics at vm/devices/support/fs/fuse/src/session.rs:576:9 with assertion failed: data.len() <= max_size as usize. Running cargo nextest run --profile agent -p fuse -E 'test(dispatch_read_reply_larger_than_size_fails)' with the regression test in fix.patch reproduces the panic prior to the fix and passes with a -EIO reply afterward.
Activity
tangruize commentedon Nov 15, 2026
Suggested Fix
Replace
assert!(data.len() <= max_size as usize)inSession::send_max_sizewith an explicit checkif data.len() > max_size as usizethat logs a rate-limited error viatracelimit::error_ratelimited!(recordinglenandmax_size) and returnsErr(lx::Error::EIO.into())soSession::dispatchreplies to the guest with-EIOinstead of aborting.Patch against OpenVMM
9d64daad3cbe14fb0591081b73c6c9648e18d0fb. Save the contents below asfix.patchand rungit apply fix.patch.fix.patch