openvmm: fuse: write and copy_file_range byte counts exceeding u32::MAX panic
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/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/session.rs, at the FuseOperation::Write and FuseOperation::CopyFileRange arms (~lines 208-217 and 391-400), where out.try_into().unwrap() panics on counts above u32::MAX. Read the write and copy_file_range signatures in src/lib.rs and the fuse_write_out.size field in src/protocol.rs, then reproduce with cargo nextest run --profile agent -p fuse -E 'test(dispatch_write_and_copy_beyond_u32_fail)'. Done means an oversized count produces a clean FUSE error reply (e.g. -EIO) instead of aborting, with a test covering both operations.
Written by the indexing model from the issue text.
Description
Summary
fuse::Fuse::write and fuse::Fuse::copy_file_range both return lx::Result<usize>, and fuse_copy_file_range_in::len is a u64, but Session::dispatch_core converts the returned byte count into fuse_write_out.size (u32) with out.try_into().unwrap(). On 64-bit hosts, a Fuse implementation returning a count larger than u32::MAX panics and aborts the VMM process instead of replying with -EIO. Found by formal verification.
Root Cause
In vm/devices/support/fs/fuse/src/session.rs and vm/devices/support/fs/fuse/src/session.rs, both FuseOperation::Write and FuseOperation::CopyFileRange unwrap out.try_into() when populating fuse_write_out:
FuseOperation::Write { arg, data } => {
let out = self.fs.write(&request, arg, data)?;
sender.send_arg(
request.unique(),
fuse_write_out {
size: out.try_into().unwrap(),
padding: 0,
},
)?;
}
FuseOperation::CopyFileRange { arg } => {
let out = self.fs.copy_file_range(&request, arg)?;
sender.send_arg(
request.unique(),
fuse_write_out {
size: out.try_into().unwrap(),
padding: 0,
},
)?;
}
The Fuse trait signatures for write and copy_file_range both return lx::Result<usize> without documenting a u32::MAX bound, and fuse_copy_file_range_in carries a 64-bit pub len: u64 even though its reply reuses fuse_write_out (pub size: u32).
Consequence
Because OpenVMM configures panic = 'abort' in both [profile.dev] and [profile.release] (Cargo.toml), any Fuse implementation on a 64-bit target whose write or copy_file_range returns a count above u32::MAX terminates the VMM process instead of failing the FUSE operation cleanly. OpenVMM's built-in VirtioFs implementation caps guest write buffers at 1 MiB (MAX_GUEST_BUFFER_SIZE) and leaves copy_file_range unimplemented (ENOSYS), so this is not reachable through VirtioFs today.
Reproduction
Initialize a fuse::Session over a minimal Fuse implementation whose write and copy_file_range return Ok(u32::MAX as usize + 1), then dispatch a FUSE_WRITE or FUSE_COPY_FILE_RANGE request. On commit 9d64daad3cbe14fb0591081b73c6c9648e18d0fb, Session::dispatch panics at vm/devices/support/fs/fuse/src/session.rs:213:46 (or session.rs:396:46) with called Result::unwrap() on an Err value: TryFromIntError(PosOverflow). Running cargo nextest run --profile agent -p fuse -E 'test(dispatch_write_and_copy_beyond_u32_fail)' reproduces the panic before fix.patch and passes afterward.
Related: #1629, #1628, #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 68/100
microsoft/nvx#1628 · 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
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 ·