openvmm: fuse: reply exceeding u32 header length panics in make_header
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- operating-systems
Research direction
Start in vm/devices/support/fs/fuse/src/reply.rs, reading make_header and each ReplySender helper that calls it. Reproduce with cargo nextest run --profile agent -p fuse -E 'test(reply_longer_than_u32_is_refused) | test(dispatch_reply_longer_than_u32_is_not_sent)'. Trace callers such as session.rs send_max_size and lib.rs read_link; done means oversized replies surface as io::Error instead of panicking and both tests pass.
Written by the indexing model from the issue text.
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.
Related: #1616, #1629, #1631, #1630.
- Dominant language
- Rust
- Stars
- 848
- Forks
- 63
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 571
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/nvx
-
area: ci
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: ci
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
openvmm: virtiofs: aggregate synthetic root st_nlink counts single-file shares as subdirectoriesOpenarea: openvmm
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/nvx#1632 · 1 comment ·
Maintainers usually reply within 1 day
-
area: openvmm
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
microsoft/nvx#1629 · 1 comment ·
Maintainers usually reply within 1 day
-
area: openvmm
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
microsoft/nvx#1631 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
obi1kenobi/cargo-semver-checks#1814 ·
Maintainers usually reply within 1 day
-
community differential help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
hffgzktbcc-blip/ounce-core#489 · 1 comment ·
Maintainers usually reply within 1 day
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pbakaus/impeccable#1560 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
pact-foundation/pact-plugins#125 ·