Repository navigation
openvmm: pin the bound on FUSE write and copy counts - #1864
Merged
Pedro Henrique Penna (ppenna) merged 2 commits intoNov 21, 2026
Merged
Conversation
OpenVMM's FUSE session converted the byte count that a file system returns for a write or a copy into the u32 of the reply with try_into().unwrap() (#1631), so a file system that reported more than u32::MAX bytes panicked, which aborts the VMM. A guest can drive a copy's count that far, since FUSE_COPY_FILE_RANGE carries a 64-bit length. Of the file systems that NVX runs, VirtioFs refuses writes of more than 1 MiB and implements no copy, and SectionFs and the dormant microVM file system implement neither request, so NVX's guests never reached the panic. Pin microsoft/openvmm 51e9af75dc7d4a3a9bd40ae52c996a822d3311cf, one commit on feature/microvm/dev 3eb7500fd: - fuse: reply EIO when a write or copy count overflows u32. Session::write_out builds both replies, and fails the request with EIO and a rate-limited error when the count does not fit, and Fuse::write and Fuse::copy_file_range document the bound. Its tests pass with the fix; without it, the two overflow tests panic with "TryFromIntError(PosOverflow)", on Windows and on Linux (nvx-mshv-test). No saved state, protocol, ABI, or format, and no version of any of them, changes. The protocol vectors and CPU profiles that nvx copies are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Map position 330, the commit of microsoft/openvmm#5198, which NVX now pins at 51e9af75d, 204 commits past the mapped tip: - 330, fuse: reply EIO when a write or copy count overflows u32. Session::write_out builds the replies to FUSE_WRITE and FUSE_COPY_FILE_RANGE, and fails with EIO a byte count from the file system that the u32 size of their fuse_write_out cannot hold, which it logs with a rate-limited error. The session converted the count with try_into().unwrap(), so a larger count panicked, which aborts the VMM. It is not a fixup of a mapped PR. Position 330 changes the two replies in session.rs, which upstream main has and no earlier chain commit changes, adds write_out after send_max_size, which position 329 changes, documents the bound on two Fuse methods in lib.rs, which positions 047, 324, 326, and 329 also change, and adds its tests, which use the harness, in a new file that it declares in the session's test module. Upstream main, bf353460f, has the defect, in the same two replies, but the commit does not apply there as it is: upstream main lacks the harness and the session tests of positions 047, 324, 326, 327, and 329, whose declarations conflict. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the documented OpenVMM pin and roadmap update.
No open issues 🎉
What changed in this PR
This PR pins OpenVMM’s fix for #1631, making FUSE write and copy counts above u32::MAX return EIO instead of aborting the VMM. NVX’s built-in file systems remain unaffected.
Changes:
- Records OpenVMM revision
51e9af75dat chain position 330, 204 commits beyond the mapped tip. - Updates the roadmap’s chain counts and explains the fix, regression-test dependencies, and prerequisites for upstreaming.
| File | Description |
|---|---|
doc/openvmm-upstream-roadmap.md |
Updates the documented pin and maps the FUSE count-overflow fix and its dependencies. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-1631-write-count-u32
branch
November 21, 2026 06:19
This was referenced Nov 21, 2026
openvmm: unsupported FUSE_COPY_FILE_RANGE_64 returns EINVAL instead of allowing Linux fallback
#1899
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1631
What does this pull request change?
It pins microsoft/openvmm#5198, which makes OpenVMM's
fuse::Sessionfail aFUSE_WRITEorFUSE_COPY_FILE_RANGEwhose file system reports more bytes than the reply can carry withEIOinstead of panicking. Both requests are answered with afuse_write_out, whosesizeis au32, and the session converted theusizethatFuse::writeandFuse::copy_file_rangereturn into it withtry_into().unwrap(), so a count aboveu32::MAXpanicked, which aborts the VMM. Now a newSession::write_outbuilds both replies, and for a count that does not fit it logs a rate-limited error and fails the request withEIO, whichSession::dispatchsends as the request's error reply; a count that fits is replied as before.Fuse::writeandFuse::copy_file_rangenow document the bound, and that a copy should copy at mostu32::MAXbytes, a short copy, even when its 64-bitlenis larger.NVX's virtio-fs file systems never report such a count:
VirtioFsrefuses a write of more than 1 MiB and implements nocopy_file_range, andSectionFsand the dormant microVM file system implement neither request. So NVX's guests see no change, and their writes are answered with the same counts, now throughwrite_out. The fix matters to any otherFuseimplementation that afuse::Sessionserves.No version is created or bumped: no ABI, machine-contract, time-ABI, snapshot, manifest, saved-state, or protocol version changes, in NVX or in OpenVMM, and no saved state or on-disk format changes.
Commits:
openvmm: pin the bound on FUSE write and copy countsmoves the gitlink from3eb7500fdto51e9af75dc7d4a3a9bd40ae52c996a822d3311cf, the head of [DO NOT REVIEW] fuse: reply EIO when a write or copy count overflows u32 openvmm#5198, and changes nothing else. The protocol vectors and CPU profiles thatnvxcopies are unchanged.doc: map the bound on FUSE write and copy counts in the OpenVMM roadmapmaps the new chain position, 330.Start with
Session::write_outand theWriteandCopyFileRangearms ofdispatch_helperin microsoft/openvmm#5198'svm/devices/support/fs/fuse/src/session.rs, then its tests insrc/session/tests/write_out.rs.It leaves
FUSE_INIT's assertions to #1630. It does not clamp a copy'slenbefore calling the file system, and it does not implementFUSE_COPY_FILE_RANGE_64. No NVX documentation describes these replies:doc/design/3.6-host-filesystem.mddescribesVirtioFs, whose behavior does not change. So no NVX documentation changes.Why is this change needed?
The session converted the file system's byte count into the reply's
u32withtry_into().unwrap(), and OpenVMM setspanic = 'abort'in both itsdevandreleaseprofiles, so aFusefile system whosewriteorcopy_file_rangereturned more thanu32::MAXaborted the whole VMM instead of failing the one request. TheFusetrait returnslx::Result<usize>from both methods and documented no bound. A guest can drive a copy's count that far:fuse_copy_file_range_in.lenis 64-bit, and Linux passed the caller's length on unclamped from 4.20 until 6.17 (torvalds/linux@1e08938c3694, "fuse: prevent overflow in copy_file_range return value"), so a file system that copies all that it is asked to counts more than the reply holds. The code is upstream OpenVMM's: upstream main,bf353460f, has the sametry_into().unwrap()in both replies.The fix fails the request with
EIO, which is what the Linux FUSE driver gives a write whose reply counts more bytes than the write carried (fuse_send_write()), and, in current kernels, a copy whose reply counts more than it asked for. The error log is rate-limited, since a guest can repeat the request.Rejected: saturating the count at
u32::MAX, which would tell the guest that fewer bytes were written than were; clamping the copy'slenbefore calling the file system, which changes what the file system is asked to do and is not needed to stop the abort; and the issue's test, which reads replies throughCapturingSender, which keeps only the last one, and checks only the overflow, so it would also pass if the session refused every count or sent two replies. The tests instead use the session's test harness, which requires exactly one reply to each request, and also check that counts up tou32::MAX, the bound itself included, are replied unchanged, in a test file of their own. The fix itself is the one that the issue proposes, with a helper that builds the whole reply.How was this change validated?
Checks and results:
OpenVMM, with Rust 1.97.1,
cargo nextest run --profile agent -p fuse, with the fix reverted (session.rsandlib.rsof3eb7500fd, with the new test module declared) and with it:write_count_beyond_u32_fails_with_eioandcopy_count_beyond_u32_fails_with_eiopanic withcalled Result::unwrap() on an Err value: TryFromIntError(PosOverflow), atsession.rs:213:46andsession.rs:396:46fuse_hello, which needs root)At the pin, on both hosts,
cargo check,cargo clippy --all-targets, andcargo doc --no-depsforfusepass, with no warning but, on Windows, theLNK4199linker message that every linked artifact gets on this machine, and on Windowscargo xtask fmt --fixchanges nothing. Before the rebase onto3eb7500fd, the same fix and tests behaved the same on85c3698f9on both hosts.python scripts/local_gates.py --base origin/dev --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles --runon Windows: all five pass.python scripts/openvmm_pin.py check-branch --topic, againstb5689cc9ca1, this branch's base ondev, andcheck-roadmap --worktreepass,python scripts/openvmm_pin.py source 51e9af75dc7d4a3a9bd40ae52c996a822d3311cf --pr 5198reports a good signature and the pull request's head, andpython scripts/nvx.py verifyandpython scripts/check_markdown_links.pypass.MicroVM scenarios at this head on nvx-mshv-test, with OpenVMM built from the pin by
python3 scripts/nvx.py build-openvmm --backend mshv(its provenance names51e9af75d, clean) and the other artifacts of releasev0.1.0-dev.c1e6adb3dbb4, fromnvx download --hypervisor mshv: the virtio-fs scenariosplatform-filesystem,filesystem-snapshot,filesystem-shares,filesystem-policy,filesystem-owner,denied-filesystem-paths,platform-aggregate-export, andfilesystem-comma-pathspass, each withpython3 scripts/nvx.py test-microvm --backend mshv --scenario NAME. Their guest writes reachVirtioFsthroughFUSE_WRITE, whose replieswrite_outnow builds.filesystem-ownerran unprivileged, so OpenVMM could not assume other host identities, and it checked that guest root and foreign callers fail withEPERM.Backend, host OS, host type, and guest: the unit tests ran on Windows 11 (local) and on Azure Linux 3.0 (nvx-mshv-test, an MSHV virtual machine); the microVM scenarios ran on nvx-mshv-test, on MSHV, with the Alpine guest.
Left to CI: the full NVX matrix, on KVM, MSHV, and WHP, which passed for this head in run 44864555400; and OpenVMM's CI of the pin, run 44863866339, which passed every job that the
openvmm-cijob requires, aspython scripts/nvx.py check-openvmm-ci --revision 51e9af75dc7d4a3a9bd40ae52c996a822d3311cfconfirms:unit tests [x64-linux],unit tests [x64-windows], andrun vmm-testsofx64-linux-amd-kvm,x64-linux-intel-mshv,x64-windows-intel, andx64-windows-amd. Its other unit-test jobs, on aarch64 Linux and Windows and on x64 and aarch64 musl, passed too, and so did its quick check,cargo hack, and binary-size jobs. One job that NVX does not require failed,run vmm-tests [x64-windows-amd-snp], in three Hyper-V SEV-SNP OpenHCL tests,snp_vmgstool_copy_igvmfile,snp_ak_refresh, andsnp_ak_cert_cache, none of them a virtio-fs test.Checklist
python3 scripts/check_test_layout.pychecks.python3 scripts/check_test_changes.py --base origin/devlists no changeto an existing test, or a Changes to existing tests section below
explains each one.
.github/copilot-instructions.mdand the skills when a convention orworkflow changes.
nvxupdatesnvx-rs/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.
OpenVMM pin
3eb7500fd, the head offeature/microvm/dev:51e9af75dfuse: reply EIO when a write or copy count overflows u32.51e9af75dc7d4a3a9bd40ae52c996a822d3311cf, the pull request's exact head.feature/microvm/devat3eb7500fd, NVX's previous pin, where [DO NOT REVIEW] fuse: reply to FUSE_IOCTL with the file system's output openvmm#5176 (openvmm: fuse: FUSE_IOCTL reply sends request input data instead of filesystem output #1615) added the session's test harness that the tests use and [DO NOT REVIEW] fuse: fail a reply longer than the request allows with EIO openvmm#5195 (openvmm: fuse: data reply exceeding requested size panics in Session::send_max_size #1629) made it require exactly one reply to each request.700c088dc, the same change on85c3698f9, from a work-in-progress branch since deleted.feature/microvm/devto51e9af75dc7d4a3a9bd40ae52c996a822d3311cf(OpenVMM's merge button squashes, which would leave the pin off the branch); then merge this pull request.