Skip to content

openvmm: pin the discard of FUSE_INIT negotiations whose reply fails - #2060

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-1898-init-reply-failure
Nov 23, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-1898-init-reply-failure

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1898

What does this pull request change?

It pins microsoft/openvmm#5248, which makes OpenVMM's fuse::Session adopt a FUSE_INIT negotiation, and mark itself initialized, only once it has sent the negotiation's reply. Session::dispatch_init negotiated in the session's own SessionInfo, through the write guard that it holds for the whole request, so when the reply could not be sent, the session stayed uninitialized but kept the values of a negotiation that the guest never received. It now negotiates in a SessionInfo of the request's own, built from the defaults and the guest's offer alone, and stores it in the session, and marks the session initialized, only after the reply is sent. A reply that cannot be sent leaves the session uninitialized with the default SessionInfo, so Session::save_state() saves the default state, and the next FUSE_INIT negotiates as on a new session. A FUSE_INIT whose negotiation's reply is sent negotiates, replies, and saves exactly as before, so NVX's guests, whose mounts receive that reply, negotiate, mount, and restore as before.

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, snapshot, or on-disk format changes.

Commits:

  • openvmm: pin the discard of FUSE_INIT negotiations whose reply fails moves the gitlink from 899dcd63f to b73db66767b9f57621c87a69b80f0a9e4e0fd9fa, the head of [DO NOT REVIEW] fuse: adopt a FUSE_INIT negotiation only once its reply is sent openvmm#5248, and changes nothing else. The protocol vectors and CPU profiles that nvx copies are unchanged.
  • doc: map the discard of FUSE_INIT negotiations whose reply fails in the OpenVMM roadmap maps the new chain position, 356.

Start with dispatch_init in microsoft/openvmm#5248's vm/devices/support/fs/fuse/src/session.rs, then its two tests at the end of src/session/tests/init.rs.

Left out: when the reply cannot be sent, the file system's Fuse::init has already run, and the session does not pair it with Fuse::destroy. #1900 defines that cleanup for an init that the session does not complete, and stacks on this change. Until then, VirtioFs::init, which records its negotiation when init runs, keeps that record after a failed reply, so a microVM save in that state still fails with "FUSE session and filesystem negotiation state disagree", as it did before this change. No NVX documentation describes this failure path: doc/design/3.6-host-filesystem.md says that every other request fails until INIT succeeds, which still holds, so no NVX documentation changes.

Why is this change needed?

The guest decides whether the reply to its FUSE_INIT can be sent: a virtio-fs reply fails when the guest's writable descriptors cannot hold it, where write_all fails with WriteZero, or lie outside guest memory. After such a failure, the uninitialized session kept the attempt's values:

  • Session::save_state() saved them with initialized: false, a state that SessionState::validate() refuses as UninitializedWithInfo, so such a save could not be restored, and a dormant microVM slot, whose save requires the default session state, refused to save at all.
  • The next FUSE_INIT reset only the fields that dispatch_init sets before Fuse::init, so the failed attempt's max_background and congestion_threshold reached the file system's init, the reply, and the saved state of the next negotiation.

The negotiation in place is upstream OpenVMM's: upstream main, b50d0c979, negotiates the same way, so its next FUSE_INIT after a failed reply inherits the same two fields, but it saves no session state. The saved state, and the validation that refuses an uninitialized state with values, come from the chain's position 047, fuse: save and restore negotiated session state.

Rejected: resetting the session's SessionInfo after a failed send, as microsoft/openvmm#5200 did for its refusal of unoffered flags, which would fix this path but leave every early return of dispatch_init to remember the reset; negotiating in a value of the request's own leaves the session untouched on every path but the one that publishes the negotiation, and the next FUSE_INIT starts from the defaults by construction.

How was this change validated?

Checks and results:

  • OpenVMM, with Rust 1.97.1, cargo nextest run --profile agent -p fuse on Windows 11, local, with the fix reverted (session.rs and lib.rs of 899dcd63f, with the new tests) and with it:

    Without the fix With it
    48 pass, 2 fail: init_whose_reply_fails_leaves_no_negotiation saves SessionState { initialized: false, info: SessionInfoState { major: 7, minor: 39, max_readahead: 131072, capable: 1073774593, capable2: 16, want: 1073774593, want2: 0, max_background: 64, congestion_threshold: 48, max_write: 1048576, time_gran: 1 } } instead of the default; init_after_a_failed_reply_negotiates_afresh replies background limits (64, 48) instead of (0, 0) all 50 pass
  • At the pin, on Windows, cargo check, cargo clippy --all-targets, and cargo doc --no-deps for fuse are clean, apart from the LNK4199 linker message that every linked artifact gets on this machine; cargo xtask fmt --fix changes nothing; and cargo nextest run --profile agent -p virtiofs passes, 230 pass and 3 skipped.

  • python scripts/local_gates.py --base origin/dev --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles --run on Windows: all five pass.

  • python scripts/openvmm_pin.py check-branch --topic, against ffac3e840b2, this branch's base on dev, and python scripts/openvmm_pin.py check-roadmap --worktree pass; python scripts/openvmm_pin.py source b73db66767b9f57621c87a69b80f0a9e4e0fd9fa --pr 5248 reports a good signature and the pull request's head; python scripts/nvx.py verify and python scripts/check_markdown_links.py pass.

  • A review of the OpenVMM commit found nothing; a review of this branch's whole diff, git diff --submodule=diff origin/dev HEAD, found two wordings, which are folded in: the roadmap now tells the refusal of unoffered flags, which replies with an error, from a reply that fails, and the pin's message says that no saved-state format changes.

  • Runtime: none of the shared test hosts, for KVM, MSHV, or WHP, accepted an SSH connection while this was open, since their VPN was down, so the microVM scenarios ran only in CI, at this head. Run 45262613381 built OpenVMM at b73db66767b9f57621c87a69b80f0a9e4e0fd9fa and passed every job, among them the microVM tests on KVM, MSHV, and WHP, whose filesystem-snapshot and platform-filesystem scenarios, among others, mount virtio-fs shares, and so negotiate FUSE_INIT through the changed dispatch_init, on each backend.

  • OpenVMM's CI of the pin: microsoft/openvmm run 45253075643, at b73db66767b9f57621c87a69b80f0a9e4e0fd9fa, passed the jobs that NVX's OpenVMM CI of the pinned revision job requires, unit tests [x64-linux], unit tests [x64-windows], and run vmm-tests on x64-linux-amd-kvm, x64-linux-intel-mshv, x64-windows-intel, and x64-windows-amd, and its quick check [fmt, clippy x64-linux]. Its x64-windows-amd-snp and x64-windows-intel-tdx VMM tests, which NVX does not require, failed, and with them the openvmm checkin gates summary.

Backend, host OS, host type, and guest: the unit tests ran on Windows 11, local. The microVM scenarios ran in CI only, on Linux KVM, Linux MSHV, and Windows WHP virtual machines, with the Alpine guest, and with the Ubuntu and Azure Linux guests in the guests-and-sandboxes jobs.

Left to CI: the microVM scenarios on every backend, which no reachable host could run; run 45262613381 passed them at this head.

Checklist

  • Tests cover the new or fixed behavior, in the layout that
    python3 scripts/check_test_layout.py checks.
  • python3 scripts/check_test_changes.py --base origin/dev lists no change
    to an existing test, or a Changes to existing tests section below
    explains each one.
  • The documentation that the change affects is updated, including
    .github/copilot-instructions.md and the skills when a convention or
    workflow changes.
  • A change to the public API of nvx updates nvx/public-api/ with
    python3 scripts/public_api.py --update.
  • Snapshots, protocols, and on-disk formats stay compatible, or the
    description says how the change versions or migrates them.

OpenVMM pin

OpenVMM's FUSE session negotiated FUSE_INIT in its own SessionInfo and
marked itself initialized only once it sent the reply
(#1898). A reply that could not be sent, as when a guest's
reply buffers cannot hold it, thus left the values of a negotiation
that the guest never received in an uninitialized session: its saved
state was one that SessionState::validate refuses, which a dormant
microVM slot refused to save, and the next FUSE_INIT inherited the
failed attempt's max_background and congestion_threshold.

Pin microsoft/openvmm b73db66767b9f57621c87a69b80f0a9e4e0fd9fa, one
commit on feature/microvm/dev 899dcd63f:

- fuse: adopt a FUSE_INIT negotiation only once its reply is sent.
  dispatch_init negotiates in a SessionInfo of the request's own, from
  the defaults and the guest's offer alone, and stores it in the
  session, and marks the session initialized, only once the reply is
  sent, so a reply that fails leaves the session uninitialized without
  a negotiation. Fuse::init documents it. Its tests pass with the fix;
  without it, the session saves the failed attempt's values, and the
  next FUSE_INIT replies its background limits, on Windows.

The reply to each NVX guest's mount is sent, so NVX's guests negotiate,
mount, and restore as before. No saved-state, protocol, or ABI 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>
…he OpenVMM roadmap

Map position 356, the commit of microsoft/openvmm#5248, which NVX now
pins at b73db6676, 230 commits past the mapped tip:

- 356, fuse: adopt a FUSE_INIT negotiation only once its reply is
  sent. Session::dispatch_init negotiates in a SessionInfo of the
  request's own, from the defaults and the guest's offer alone, and
  stores it in the session, and marks the session initialized, only
  once the reply is sent. It negotiated in the session's own
  SessionInfo, so a reply that could not be sent left the values of a
  negotiation that the guest never received in an uninitialized
  session, whose saved state SessionState::validate refuses, and the
  next FUSE_INIT inherited the failed attempt's max_background and
  congestion_threshold.

Position 356 is not yet assigned to a PR. It changes dispatch_init in
session.rs, in lines that PR13's position 047 and position 328 also
change, documents the adoption on Fuse::init in lib.rs after position
328's paragraph, and adds two tests to position 328's tests of
FUSE_INIT, which use the harness of positions 321 and 325 and PR13's
session state. It is no PR13 fixup, although the failed attempt's
values reached position 047's saved state: the in-place negotiation
is upstream's, and the commit changes lines that position 328 adds,
so it follows position 328. Upstream main, b50d0c979, negotiates in
place too, so its next FUSE_INIT after a failed reply inherits the
same two fields, but it saves no session state; replaying the commit
there conflicts in lib.rs, session.rs, and position 328's init.rs, so
it cannot go upstream on its own.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the roadmap pin update documenting the FUSE_INIT negotiation-state fix.

No open issues 🎉

What changed in this PR

Pins OpenVMM’s fix for #1898 so FUSE_INIT negotiation state is adopted only after the reply is sent. This prevents failed replies from leaving stale session values or affecting later initialization attempts.

Changes:

  • Updates the roadmap’s pin to b73db6676, adds chain position 356, and adjusts commit counts.
  • Documents the fix’s behavior, dependencies, and unchanged saved-state format.
  • Clarifies that filesystem cleanup after failed initialization remains deferred to #1900.
File Description
doc/​openvmm-upstream-roadmap.md Maps the new pin and explains its negotiation-state fix, upstream dependencies, and remaining cleanup limitation.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openvmm: FUSE session retains negotiated values when the INIT reply cannot be sent

2 participants