Skip to content

openvmm: pin the refusal of unoffered FUSE_INIT flags - #1870

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-1630-init-flags
Nov 21, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-1630-init-flags

Conversation

@ppenna

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

Copy link
Copy Markdown
Contributor

Fixes #1630

What does this pull request change?

It pins microsoft/openvmm#5200, which makes OpenVMM's fuse::Session fail FUSE_INIT with EIO, instead of panicking, when the file system's Fuse::init wants a flag that the guest did not offer, and keeps the guest's version and capabilities when init replaces the session information. Session::dispatch_init fills a SessionInfo from the guest's FUSE_INIT, lets the file system negotiate in Fuse::init(&mut SessionInfo), and then asserted that what init wants is among what the guest offered, with assert!(info.want & !info.capable == 0) and, unless init dropped FUSE_INIT_EXT, assert!(info.want2 & !info.capable2 == 0). It now takes the version and the guest's capabilities before init and restores them after it, and when init wants a flag, or, while it keeps FUSE_INIT_EXT, an extended flag, that the guest did not offer, it logs a rate-limited error, resets the session information, so that the session stays uninitialized and saves no negotiation, and fails the request with EIO, which Session::dispatch sends as its error reply. Fuse::init now documents both. A negotiation within the offer is replied and saved as before.

NVX's virtio-fs file systems never want an unoffered flag: VirtioFs::init wants only flags that info.capable() and info.capable2() hold, and SectionFs and the dormant microVM file system keep the default init. So NVX's guests see no change: they negotiate, mount, and restore as before. The fix matters to any other Fuse implementation that a fuse::Session serves.

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:

Start with dispatch_init in microsoft/openvmm#5200's vm/devices/support/fs/fuse/src/session.rs, then its tests in src/session/tests/init.rs.

It leaves out what does not follow from the issue: Fuse::destroy is still not called after a refused init, which no NVX file system needs, since VirtioFs, which records its negotiation in init, never wants an unoffered flag, so the session never refuses it; and a FUSE_INIT whose reply cannot be sent still leaves the negotiated values in an uninitialized session, as before. No NVX documentation describes this negotiation's failure: doc/design/3.6-host-filesystem.md describes what VirtioFs grants, which does not change. So no NVX documentation changes.

Why is this change needed?

The guest decides what FUSE_INIT offers, through fuse_init_in.flags and flags2, and OpenVMM sets panic = 'abort' in both its dev and release profiles, so a Fuse file system that wanted a flag without checking info.capable() aborted the whole VMM whenever a guest left that flag out, instead of failing FUSE_INIT. The Fuse trait documented no such bound. The assertions also read the guest's capabilities back from the SessionInfo that init may change: its major, minor, capable, and capable2 are private, but SessionInfo converts from the public SessionInfoState, whose fields are public, so an init that replaced it with one that claimed every capability passed both assertions, replied flags that the guest never offered, and left in Session::save_state() a version and capabilities that the guest never sent. The assertions are upstream OpenVMM's: upstream main, bf353460f, has the same two. The conversion is the chain's: position 047, fuse: save and restore negotiated session state, added SessionInfoState and made SessionInfo Copy and convertible from it.

EIO is what dispatch_init already answers its other failures of FUSE_INIT with, such as an unsupported version. libfuse refuses the same negotiation with EPROTO (want_flags_valid() in do_init()), but the Linux FUSE driver treats any error reply to FUSE_INIT alike, as a connection error (process_init_reply()), so the code makes no difference to the guest. The error log is rate-limited, since a guest can repeat FUSE_INIT.

Rejected: masking want and want2 to the offer, which would silently drop flags that the file system relies on; and the issue's tests, which read replies through CapturingSender, which keeps only the last one. The tests instead use the session's test harness, which requires exactly one reply to each request, in a test file of their own. The fix itself is the one that the issue proposes.

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.rs and lib.rs of 51e9af75d, with the new test module declared) and with it:

    Host With the fix reverted With the fix
    Windows 11, local, at the pin 2 of 48 fail: init_rejects_flags_the_client_did_not_offer panics with assertion failed: info.want & !info.capable == 0 at session.rs:490, and, with only its flags2 case, with assertion failed: info.want2 & !info.capable2 == 0 at session.rs:496; init_keeps_the_client_version_and_capabilities gets no error reply (0, not -5), and, with only its second case, the session saves (8, 0, 0xffffffff, 0xffffffff) instead of the guest's (7, 31, 1, 0) all 48 pass
    Azure Linux 3.0, virtual machine (nvx-kvm-test), at the pin the same two failures, at the same lines 48 pass, 1 skipped (fuse_hello, which needs root)
  • At the pin, on both hosts, cargo check, cargo clippy --all-targets, and cargo doc --no-deps for fuse pass, with no warning but, on Windows, the LNK4199 linker message that every linked artifact gets on this machine; on Windows, cargo xtask fmt --fix changes nothing; on nvx-kvm-test, cargo nextest run --profile agent -p virtiofs passes (171 pass, 1 skipped). Before the rebase onto 51e9af75d, the same fix behaved the same on 85c3698f9, on both hosts, and on 3eb7500fd, on Windows.

  • 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 c753e7b4c28, this branch's base on dev, and check-roadmap --worktree pass, python scripts/openvmm_pin.py source 32c0c2bbc90a3f7632386b87a524c71b7e11ecc9 --pr 5200 reports a good signature and the pull request's head, and python scripts/nvx.py verify and python scripts/check_markdown_links.py pass.

  • MicroVM scenarios at this head on nvx-kvm-test, with OpenVMM built from the pin by python3 scripts/nvx.py build-openvmm --backend kvm (its provenance names 32c0c2bbc, clean) and the other artifacts of release v0.1.0-dev.b0176f4f543e, from nvx download --hypervisor kvm: the virtio-fs scenarios platform-filesystem, filesystem-snapshot, filesystem-shares, filesystem-policy, filesystem-owner, denied-filesystem-paths, platform-aggregate-export, and filesystem-comma-paths pass, each with python3 scripts/nvx.py test-microvm --backend kvm --scenario NAME. Each guest mount negotiates FUSE_INIT through the changed dispatch_init, and filesystem-snapshot restores the negotiation that it saves. filesystem-owner ran unprivileged, so OpenVMM could not assume other host identities, and it checked that guest root and foreign callers fail with EPERM.

Backend, host OS, host type, and guest: the unit tests ran on Windows 11 (local) and on Azure Linux 3.0 (nvx-kvm-test, a KVM virtual machine); the microVM scenarios ran on nvx-kvm-test, on KVM, with the Alpine guest.

Left to CI: the full NVX matrix, on KVM, MSHV, and WHP, which passed for this head in run 44876923910; and OpenVMM's CI of the pin, run 44875530937, which passed every job that the openvmm-ci job requires, as python scripts/nvx.py check-openvmm-ci --revision 32c0c2bbc90a3f7632386b87a524c71b7e11ecc9 confirms: unit tests [x64-linux], unit tests [x64-windows], and run vmm-tests of x64-linux-amd-kvm, x64-linux-intel-mshv, x64-windows-intel, and x64-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, binary-size jobs, and the run vmm-tests of aarch64-windows, x64-linux-amd-snp-mshv, x64-windows-intel-tdx, and x64-windows-intel-mi-secure. One job that NVX does not require failed, run vmm-tests [x64-windows-amd-snp], in two Hyper-V SEV-SNP OpenHCL tests, snp_vmgstool_copy_igvmfile and snp_seal_signer, neither of them a virtio-fs test.

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-rs/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 asserted that the flags that a file system's
init wants are among those that the guest offered in FUSE_INIT
(#1630), so a file system that wanted a flag that the
guest left out panicked, which aborts the VMM. It also read the
guest's capabilities back from the SessionInfo that init may replace,
so an init that claimed every capability passed the check, replied
flags that the guest never offered, and saved a version and
capabilities that the guest never sent. Of the file systems that NVX
runs, VirtioFs wants only flags that the guest offers, and SectionFs
and the dormant microVM file system keep the default init, so NVX's
guests never reached either.

Pin microsoft/openvmm 32c0c2bbc90a3f7632386b87a524c71b7e11ecc9, one
commit on feature/microvm/dev 51e9af75d:

- fuse: fail FUSE_INIT when init wants flags the client did not offer.
  dispatch_init keeps the version and the guest's capabilities across
  init, and fails FUSE_INIT with EIO and a rate-limited error, leaving
  the session uninitialized with no negotiation to save, when init
  wants a flag, or an extended flag while it keeps FUSE_INIT_EXT, that
  the guest did not offer. Fuse::init documents both. Its tests pass
  with the fix; without it, one panics on the assertion and the other
  gets no error reply, on Windows and on Linux (nvx-kvm-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 331, the commit of microsoft/openvmm#5200, which NVX now
pins at 32c0c2bbc, 205 commits past the mapped tip:

- 331, fuse: fail FUSE_INIT when init wants flags the client did not
  offer. Session::dispatch_init fails FUSE_INIT with EIO and a
  rate-limited error, and leaves the session uninitialized with no
  negotiation to save, when the file system's init wants a flag, or,
  while it keeps FUSE_INIT_EXT, an extended flag, that the guest did
  not offer, and it keeps the version and the guest's capabilities
  across init. It asserted the bound, so such a file system panicked,
  which aborts the VMM, and read the capabilities back from the
  SessionInfo that init may replace with one converted from a
  SessionInfoState.

It is not a fixup of a mapped PR: it changes nothing that one adds.
Position 331 changes dispatch_init in session.rs, whose lines that it
changes upstream main has and no earlier chain commit changes,
documents Fuse::init in lib.rs, which positions 047, 324, 326, 329,
and 330 also change, and adds its tests, which use the harness and
PR13's session state, in a new file that it declares in the session's
test module. The replacement that it stops needs PR13's position 047,
which made SessionInfo convertible from SessionInfoState, so the
roadmap asks that PR13 go upstream with it. Upstream main, bf353460f,
has the two assertions; replaying the commit there conflicts only in
the test module's declarations, and without its tests its change
applies there and fuse type-checks, but its tests need what upstream
main lacks.

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

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.

🔵 Needs a closer look

Maintainer confirmation is needed because exact-pin OpenVMM CI remains pending and microsoft/openvmm#5200 has not been fast-forwarded onto feature/microvm/dev.

No open issues 🎉

What changed in this PR

Pins microsoft/openvmm#5200 to address #1630: unoffered FUSE_INIT flags return EIO instead of aborting the VMM, and negotiation preserves the guest’s version and capabilities.

Changes:

  • Records pin 32c0c2bbc at chain position 331, 205 commits beyond the mapped tip.
  • Documents the fix’s behavior, upstream dependencies, and why NVX’s existing filesystems remain unaffected.
File Description
doc/​openvmm-upstream-roadmap.md Updates the pin, chain counts, graph, and commit mapping; explains the negotiation fix and upstream prerequisites.

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: dispatch_init asserts on unoffered Fuse::init flags and trusts mutable SessionInfo capabilities

2 participants