Repository navigation
Description
Summary
fuse::reply::make_header computes the total FUSE reply length (size_of::<fuse_out_header>() + extra_len) and converts it to u32 using .try_into().unwrap(), while ReplySender::send_string computes value.len() + 1 without saturation. Whenever a fuse::Fuse implementation or ReplySender caller sends more than u32::MAX - 16 payload bytes (such as a FUSE_READ reply of u32::MAX bytes or a u32::MAX - 16-byte symlink target), make_header panics and aborts the VMM process instead of returning an io::Error. Found by formal verification.
Root Cause
In vm/devices/support/fs/fuse/src/reply.rs, every ReplySender helper (send_arg, send_error, send_data, send_arg_data, and send_string) constructs the 16-byte fuse_out_header via an infallible make_header helper that unwraps try_into() into u32:
/// Send a string reply.
fn send_string(&mut self, unique: u64, value: lx::LxString) -> io::Result<()> {
tracing::trace!(unique, len = value.len(), "reply");
let header = make_header(unique, value.len() + 1, 0);
let header = header.as_bytes();
self.send(&[
io::IoSlice::new(header),
io::IoSlice::new(value.as_bytes()),
io::IoSlice::new(&[0]),
])
}
}
fn make_header(unique: u64, extra_len: usize, error: i32) -> fuse_out_header {
fuse_out_header {
len: (size_of::<fuse_out_header>() + extra_len)
.try_into()
.unwrap(),
error,
unique,
}
}Even when a Fuse implementation strictly honors the guest's u32 size parameter in read, read_dir, read_dir_plus, get_xattr, or list_xattr (passing Session::send_max_size for max_size in (u32::MAX - 15)..=u32::MAX), adding size_of::<fuse_out_header>() (16 bytes) pushes the total frame size past u32::MAX, causing .try_into().unwrap() to panic. Likewise, Fuse::read_link returns an arbitrary LxString without any length cap, and send_string adds 1 for the NUL terminator unchecked before calling make_header.
Consequence
Because OpenVMM sets panic = 'abort' in both [profile.dev] and [profile.release] (Cargo.toml), a Fuse implementation returning a valid-within-arg.size buffer of u32::MAX - 15 to u32::MAX bytes (or a symlink target of at least u32::MAX - 16 bytes) aborts the entire VMM process rather than surfacing an io::Error from ReplySender. OpenVMM's built-in VirtioFs implementation bounds replies to at most 1 MiB (MAX_GUEST_BUFFER_SIZE), so this is not reachable through VirtioFs in practice.
Reproduction
Call ReplySender::send_data with u32::MAX as usize - 15 zero bytes, call ReplySender::send_string with a u32::MAX as usize - 16-byte LxString, or dispatch a FUSE_READ request with arg.size = u32::MAX to a Fuse implementation whose read returns Ok(vec![0; arg.size as usize]). On commit 9d64daad3cbe14fb0591081b73c6c9648e18d0fb, all three panic at vm/devices/support/fs/fuse/src/reply.rs:91:14 with called Result::unwrap() on an Err value: TryFromIntError(PosOverflow). Running cargo nextest run --profile agent -p fuse -E 'test(reply_longer_than_u32_is_refused) | test(dispatch_reply_longer_than_u32_is_not_sent)' reproduces both panics before fix.patch and passes afterward.
Activity
tangruize commentedon Nov 15, 2026
Suggested Fix
Change
make_headerto returnio::Result<fuse_out_header>, rejectingextra_len > u32::MAX as usize - size_of::<fuse_out_header>()withErr(io::ErrorKind::InvalidInput.into())before casting(size_of::<fuse_out_header>() + extra_len) as u32. Propagatemake_header(...)?acrosssend_arg,send_error,send_data,send_arg_data, andsend_string, and computevalue.len().saturating_add(1)insend_stringto avoidusizeaddition overflow. InSession::dispatch, the resultingOperationError::SendErroris logged viatracelimit::error_ratelimited!without sending a malformed frame or aborting the VMM.Patch against OpenVMM
9d64daad3cbe14fb0591081b73c6c9648e18d0fb. Save the contents below asfix.patchand rungit apply fix.patch.fix.patch