Repository navigation
[DO NOT REVIEW] fuse: fail FUSE_INIT when init wants flags the client did not offer - #5200
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoNov 21, 2026
Conversation
Session::dispatch_init asserted that the flags which Fuse::init wants are among those that the client offered (microsoft/nvx#1630). A file system whose init wants a flag that the guest did not offer thus panicked, which aborts the VMM process, since its profiles abort on panic, instead of failing FUSE_INIT. And dispatch_init read the client's capabilities back from the SessionInfo that init may replace, as with the public SessionInfo::from(SessionInfoState): an init that claimed every capability passed the check, sent the guest flags that it never offered, and left in save_state a version and capabilities that the client never sent. dispatch_init now keeps the version and the client's capabilities that it sets before init, and restores them after it, whatever init did to the SessionInfo. When init wants a flag that the client did not offer, or an extended flag that it did not offer while init keeps FUSE_INIT_EXT, without which dispatch_init discards the extended flags, dispatch_init logs a rate-limited error, resets the SessionInfo, so that the session stays uninitialized and saves no negotiation, and replies with EIO, as for its other FUSE_INIT failures. Fuse::init documents both. VirtioFs::init wants only flags that the client offers, so its negotiation does not change. Tests, in fuse's session tests of init: - init_rejects_flags_the_client_did_not_offer, with a file system that wants a flag or an extended flag that the client did not offer, panics at feature/microvm/dev 51e9af7 on the assertion of each. - init_keeps_the_client_version_and_capabilities, with one whose init claims version 8.0 and every capability, there replies without an error to a want beyond the offer, and saves that version and those capabilities. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
requested a review
from a team
as a code owner
November 21, 2026 06:26
5 tasks done
Pedro Henrique Penna (ppenna)
merged commit Nov 21, 2026
32c0c2b
into
feature/microvm/dev
104 of 105 checks passed
github-merge-queue Bot
pushed a commit
to microsoft/nvx
that referenced
this pull request
Nov 21, 2026
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>
This was referenced Nov 23, 2026
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.
Refs microsoft/nvx#1630.
NVX pins the head of this branch, so this is a prerequisite of the NVX change that pins it, and it lands by fast-forwarding
feature/microvm/devto that exact commit, not with the merge button, which squashes.What and why
fuse::Session::dispatch_initinvm/devices/support/fs/fuse/src/session.rsfills aSessionInfofrom the guest'sFUSE_INIT, lets the file system negotiate inFuse::init(&mut SessionInfo), and then asserted that whatinitwants is among what the guest offered:assert!(info.want & !info.capable == 0)and, unlessinitdroppedFUSE_INIT_EXT,assert!(info.want2 & !info.capable2 == 0). The guest decides the offer, throughfuse_init_in.flagsandflags2, so a file system that wants a flag without checkinginfo.capable()panicked the dispatcher whenever the guest left that flag out, and, withpanic = 'abort'in thedevandreleaseprofiles, aborted the VMM instead of failingFUSE_INIT.The assertions also read the guest's capabilities back from the
SessionInfothatinitmay change. Itsmajor,minor,capable, andcapable2are private, but on this branchSessionInfoconverts fromSessionInfoState, whose fields are public, soinitcan replaceinfowith one whose version and capabilities it chose. One that claimed every capability passed both assertions, replied flags that the guest never offered, and left inSession::save_state()a version and capabilities that the guest never sent.dispatch_initnow takes the version and the guest's capabilities before it callsinitand puts them back after it, whateverinitdid toinfo. Wheninitwants a flag that the guest did not offer, or, while it keepsFUSE_INIT_EXT, an extended flag that the guest did not offer,dispatch_initlogs the unoffered flags withtracelimit::error_ratelimited!, since a guest can repeatFUSE_INIT; resetsinfoto its default, so that the session stays uninitialized andsave_state()saves no negotiation, asSessionState::validate()requires of an uninitialized session; and fails the request withEIO, whichSession::dispatchsends as its error reply, as for the otherFUSE_INITfailures ofdispatch_init.Fuse::initnow documents both. A negotiation within the offer is replied and saved as before.VirtioFs::initwants only flags thatinfo.capable()andinfo.capable2()hold, andSectionFsand the dormant microVM file system keep the defaultinit, so none of them changes its negotiation.libfuse refuses the same negotiation with
EPROTO(want_flags_valid()indo_init()); the Linux FUSE driver treats any error reply toFUSE_INITalike, as a connection error (process_init_reply()), soEIO, whichdispatch_initalready uses for an unsupported version, serves as well. Rejected: maskingwantandwant2to the offer, which would silently drop flags that the file system relies on.The issue's patch makes the same change. Its tests read replies through
CapturingSender, which keeps only the last one; the tests here use the session's test harness, which requires exactly one reply to each request, whose header counts its whole length.Upstream main
bf353460fhas the same two assertions, but itsSessionInfoconverts from noSessionInfoState, which only this branch has, so only the abort is upstream's. This commit does not apply to upstream main as it is: replaying it there conflicts only in the module declarations of the session's test module, and its tests use the session's test harness andSessionInfoState. Without its tests, its change applies there, andcargo check -p fusepasses.No saved state, protocol, ABI, or format, and no version of any of them, changes.
Tests
In
session::tests::init, each request goes through the session's test harness:init_rejects_flags_the_client_did_not_offer: a file system that wantsFUSE_DO_READDIRPLUS, which the guest'sflagsdid not offer, or, withFUSE_INIT_EXToffered and kept,FUSE_DIRECT_IO_ALLOW_MMAP_FLAG2, which itsflags2did not offer, gets an-EIOreply with no data, and its session stays uninitialized and saves the default state.init_keeps_the_client_version_and_capabilities: a file system whoseinitreplacesinfowith one that claims version 8.0 and every capability gets an-EIOreply when it also wants a flag beyond the offer; when it wants nothing more, it gets the offered flags, and the session saves the guest's version 7.31 and capabilities, whichSessionState::validate()accepts.Validation
With
cargo nextest run --profile agent -p fuse, with the fix reverted (session.rsandlib.rsof51e9af75d, with the new test module declared) and with it:init_rejects_flags_the_client_did_not_offerpanics withassertion failed: info.want & !info.capable == 0atsession.rs:490, and, with only itsflags2case, withassertion failed: info.want2 & !info.capable2 == 0atsession.rs:496;init_keeps_the_client_version_and_capabilitiesgets no error reply (0, not-5) and, with only its second case, saves(8, 0, 0xffffffff, 0xffffffff)instead of(7, 31, 1, 0)nvx-kvm-test, an Azure Linux 3.0 virtual machinefuse_hello, which needs root)On both hosts, at this head,
cargo check,cargo clippy --all-targets, andcargo doc --no-depsforfuseare clean, but for theLNK4199linker message that every linked artifact gets on the Windows machine; on Windows,cargo xtask fmt --fixchanges nothing. Onnvx-kvm-test,cargo nextest run --profile agent -p virtiofspasses at this head too (171 pass, 1 skipped), sinceVirtioFsis the in-tree file system that negotiates ininit. Before the rebase onto51e9af75d, the same fix behaved the same on85c3698f9, on Windows and onnvx-kvm-test.NVX's eight virtio-fs microVM scenarios, among them
platform-filesystem,filesystem-snapshot, andplatform-aggregate-export, pass onnvx-kvm-test, on KVM, with the Alpine guest and OpenVMM built from this head, in microsoft/nvx#1870, which pins it. Each guest mount negotiatesFUSE_INITthrough the changeddispatch_init, andfilesystem-snapshotrestores the negotiation that it saves. In this pull request's CI, run 44875530937, every job that NVX requires passed, and so did every unit-test job, on x64 and aarch64, Linux, musl, and Windows;run vmm-tests [x64-windows-amd-snp]failed in two Hyper-V SEV-SNP OpenHCL tests,snp_vmgstool_copy_igvmfileandsnp_seal_signer, neither of them a virtio-fs test.