Repository navigation
openvmm: pin microVM restores of handles opened with access mode 3 - #2146
Merged
Pedro Henrique Penna (ppenna) merged 3 commits intoNov 25, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the OpenVMM revision pin and restore-semantics documentation updates.
No open issues 🎉
What changed in this PR
This PR pins the OpenVMM fix for #2125, allowing microVM snapshots to restore virtio-fs handles opened with Linux access mode 3 while preserving their access restrictions and the saved-state format.
Changes:
- Records OpenVMM revision
770bc61e7at roadmap position 390, including its dependencies and upstream mapping. - Clarifies that restore preserves handle access modes and requires writable nodes for
O_WRONLYandO_RDWRhandles.
| File | Description |
|---|---|
doc/openvmm-upstream-roadmap.md |
Updates the pinned revision, chain counts, and mapping for the restore fix. |
doc/design/3.6-host-filesystem.md |
Documents writable-handle validation and preservation of access mode 3 during restore. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/issue-2135-virtiofs-last-node-id
branch
from
November 25, 2026 17:06
0c97865 to
8bfe42a
Compare
This was referenced Nov 25, 2026
A microVM guest that opened a virtio-fs file with access mode 3, which neither reads nor writes, and held it open could save the VM's state, but its restore failed with "saved handle has invalid access mode", on read-write and read-only shares alike (#2125). FUSE_OPEN accepts that access mode, but the restore's validation rejected it, and also took every access mode other than O_RDONLY for one that writes. Pin microsoft/openvmm 770bc61e7b2c683b092bffb5c8cd83b8696cf54a, the head of microsoft/openvmm#5282, one commit on 350018ce4, the head of microsoft/openvmm#5281, which NVX pins below this commit: - virtiofs: restore microVM handles opened with access mode 3. A restore keeps every access mode, and needs a writable node only for a handle whose access mode is O_WRONLY or O_RDWR, as FUSE_OPEN does. Its test fails without the fix, on a read-write share, on a read-only share, and outside the writable paths, and passes with it, on Windows and on Linux, and the virtiofs package's tests pass at the pin on both. 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>
… OpenVMM roadmap Map position 390, the commit of microsoft/openvmm#5282, which NVX now pins at 770bc61e7, 264 commits past the mapped tip, on 350018ce4, position 389, the head of microsoft/openvmm#5281: - 390, virtiofs: restore microVM handles opened with access mode 3. A restore reopens a handle that the guest opened with access mode 3, which neither reads nor writes, rather than reject it, and needs a writable node only for a handle whose access mode is O_WRONLY or O_RDWR, as FUSE_OPEN does, so that a snapshot of a guest that holds such a handle on a read-only share or outside the writable paths restores (#2125). Position 390 is not yet assigned to a PR. It fixes a defect of PR18's position 083, whose reopen_flags rejected access mode 3 and whose restore took every access mode but O_RDONLY for a writable one, as position 160 kept doing for its writable paths, but its code changes position 160's line and calls position 334's opens_for_writing, and its test needs positions 160, 164, and 352, so it is not a PR18 fixup. Of positions 372-389, only 385 and 389 change one of its files, fs_tests.rs. Upstream main, 8d4e03132, lacks the defect, since it lacks the microVM's saved state, and replaying the commit there conflicts in the microVM's state.rs and fs_tests.rs, so it cannot go upstream on its own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The host filesystem's design said that a restore validates writable handles only where the export or child is read-write and every name of the node is writable, and that it reopens every handle with its saved open flags. OpenVMM rejected handles with Linux's access mode 3, which neither reads nor writes, and took them for writable ones, so a guest that held such a handle, which OPEN gives on any share, could save but not restore the VM (#2125). With the OpenVMM fix, only handles whose access mode is O_WRONLY or O_RDWR need writable nodes, as OPEN requires, and a restored handle keeps its access mode, so say both. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/issue-2125-virtiofs-access-mode-3
branch
from
November 25, 2026 17:57
d061655 to
156fef3
Compare
This was referenced Nov 25, 2026
Base automatically changed from
agents/issue-2135-virtiofs-last-node-id
to
dev
November 25, 2026 18:39
Pedro Henrique Penna (ppenna)
removed this pull request from the merge queue due to a manual request
Nov 25, 2026
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-2125-virtiofs-access-mode-3
branch
November 25, 2026 21:29
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 #2125
Stacked on #2144 (
agents/issue-2135-virtiofs-last-node-id), which has merged, so GitHub retargeted this pull request todev, where only its three commits remain (see OpenVMM pin for the landing order).What does this pull request change?
A microVM guest that opened a file on a virtio-fs share with access mode 3 (
O_ACCMODE == 3), which Linux'sopen(2)reserves to check for read and write permission and return a descriptor that can neither read nor write, and held it open, could save the VM's state, but restoring that snapshot failed with "saved handle has invalid access mode", on read-write and read-only shares alike, and outside a share's writable paths too. Now a restore reopens such a handle with the same access mode, so it still neither reads nor writes, and the snapshot restores. A restore still refuses a handle whose access mode isO_WRONLYorO_RDWRon a read-only share or child or outside the writable paths.The fix is in OpenVMM, microsoft/openvmm#5282, which this pull request pins:
virtiofs: restore microVM handles opened with access mode 3. Invm/devices/virtio/virtiofs/src/microvm/state.rs,reopen_flagsno longer rejects access mode 3, andvalidate_microvm_statedecides whether a saved handle writes withopens_for_writing, the rule with whichFUSE_OPENrefuses opens of read-only nodes, applied to the flags that reopen the handle, which dropO_TRUNC: onlyO_WRONLYandO_RDWRneed a writable node. One regression test inmicrovm/fs_tests.rs.The NVX commits are the gitlink-only pin; the mapping of the commit, position 390, in the OpenVMM roadmap; and two sentences of Restore that say which handles a restore treats as open for writing, those whose access mode is
O_WRONLYorO_RDWR, asOPENrequires, and that a restored handle keeps its access mode, even access mode 3. Start with the OpenVMM diff:git diff --submodule=diff origin/dev...HEAD.Left out and limitations:
O_RDWRdoes, so a restore fails, as for any handle that it cannot reopen, when the VMM's user has lost that permission since the capture.O_DIRECT) and virtio-fs microVM: FUSE_CREATE stores raw guest open flags in its handle, causing restore to fail #2129 (the raw flags thatFUSE_CREATErecords), are left to their own pull requests.Why is this change needed?
A guest that held such a handle, which
FUSE_OPENgives on any share, made snapshots that saved but never restored.Root cause:
FUSE_OPENaccepts access mode 3, as upstream's does:util::open_flagskeeps the access mode, andcheck_open_readonlyrefuses on a read-only node only the opens thatopens_for_writingnames, those forO_WRONLYorO_RDWR, or withO_TRUNC. Position 083 of the microVM chain (6315c16c5, PR18 of the OpenVMM roadmap), which made the microVM's virtio-fs state persistent, saves a handle's open flags as they are, but itsreopen_flagsrejected access mode 3, and its restore refused on a read-only share every handle whose access mode is notO_RDONLY, a rule that position 160 (2ea6f1e0b) extended to the writable paths. So even without that rejection, a read-only share or child, or a node outside the writable paths, would have refused the handle.Alternatives rejected:
FUSE_OPEN, which the issue mentions: it would refuse a valid Linux open that the device already serves, and change live behavior to fix a restore.O_WRONLYandO_RDWRin the validation, is the approach taken, except that the validation callsopens_for_writing, the rule thatFUSE_OPENapplies, on the flags that reopen the handle, so that the open and the restore cannot disagree again.O_RDONLY: the restored handle could then read, which the guest's could not.How was this change validated?
Checks and results. "Before" is OpenVMM
1633b3797, the head offeature/microvm/devand NVX's pin ondev, with the new test; "after" is the fix on1633b3797(ab986fcb3) and, after its rebase onto microsoft/openvmm#5281, the pin,770bc61e7, whose patchgit range-diffreports equal apart from the imports' context. Hosts: Windows 11 Enterprise (local workstation, build 26300, NTFS) and a Linux KVM test VM (Azure Linux 3, kernel 6.18, x86_64, tmpfs).cargo nextest run --profile agent -p virtiofs -E 'test(a_handle_that_neither_reads_nor_writes_survives_save_and_restore)'(new test), on Windows and Linuxab986fcb3and at the pinreopen_flagschange, not committed, on Windowscargo check,cargo clippy --all-targets, andcargo doc --no-deps, each-p virtiofsab986fcb3; at the pin,clippyon Windows and all three on Linuxcargo nextest run --profile agent -p virtiofsab986fcb3), 242 passed, 3 skipped (pin); Linux: 242 passed, 1 skipped (ab986fcb3), 243 passed, 1 skipped (pin)cargo xtask fmt --fixab986fcb3and at the pincargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignored, and the same with--test openvmm_cpu_profilesnvxcopies are unchangedpython scripts/openvmm_pin.py check-branch --topic --target origin/agents/issue-2135-virtiofs-last-node-id,python scripts/openvmm_pin.py check-roadmap --worktree,python scripts/check_markdown_links.py,git diff --checkpython scripts/local_gates.py --base origin/agents/issue-2135-virtiofs-last-node-id --run --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profilespython scripts/nvx.py check-openvmm-ci --revision 770bc61e7b2c683b092bffb5c8cd83b8696cf54aBackend, host OS, host type, and guest: no microVM run. No scenario opens a file with access mode 3, which takes a guest program that calls
open(2)with it, and the new test drives the sameFUSE_OPEN, save, and restore code that such a guest's requests reach.OpenVMM's CI of the pin, run 45657379614, passed the six jobs that NVX requires on its second attempt. The first lost
build artifacts (for VMM tests) [x64-linux]when its runner received a shutdown signal while it restored a cache, which skipped every x64run vmm-testsjob; one rerun of the failed jobs passed them. The first NVX CI run of this branch, 45660293267, failed only itsOpenVMM CI of the pinned revisionjob for that reason, and the run of the current head, after the rebuild on #2144's amended roadmap commit, is 45670203389.Left to CI: the microVM scenarios on KVM, MSHV, and WHP,
filesystem-snapshotamong them, which check that the restores of other handles still work; the NVX CLI jobs, including thenvx-cligate's Python tests, which this branch does not change and which install Python packages, so they did not run here; and OpenVMM's CI of the pin, whichopenvmm-cichecks.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/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.
Changes to existing tests
None:
python scripts/check_test_changes.py --base origin/agents/issue-2135-virtiofs-last-node-idlists no change to an existing test, and the OpenVMM pull request adds one test, and the four imports that it uses, tomicrovm/fs_tests.rs, and changes no test.OpenVMM pin
770bc61e7b2c683b092bffb5c8cd83b8696cf54a, one commit on350018ce4, the head of [DO NOT REVIEW] virtiofs: let a new microVM object take the last node ID openvmm#5281, which the base branch pins.350018ce4, position 389), which openvmm: pin new microVM objects that take the last node ID #2144 pins, has landed:feature/microvm/devis at350018ce4, so this pull request's commit is the only one left to land.ab986fcb3on1633b3797, on which the first Windows and Linux evidence above was collected, apart from the imports' context, asgit range-diff 1633b3797..ab986fcb3 350018ce4..770bc61e7reports; the rebase onto #5281 conflicted only in those imports.opens_for_writing, and its test needs positions 160, 164, and 352, so it is not a PR18 fixup. It cannot go upstream on its own: upstream main,8d4e03132, lacks the microVM's saved state, and replaying the commit there conflicts.nvxcopies are unchanged.feature/microvm/devfrom350018ce4exactly to770bc61e7b2c683b092bffb5c8cd83b8696cf54a, not with the merge button, which squashes, before this pull request merges. That fast-forward has happened:python scripts/openvmm_pin.py land 770bc61e7b2c683b092bffb5c8cd83b8696cf54a --remote originreports thatfeature/microvm/devis already at the pin.