From 74a9662d787a055a292d3f87d2c1f99b931450e5 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Wed, 25 Nov 2026 09:55:26 -0800 Subject: [PATCH 1/3] openvmm: pin microVM restores of handles opened with access mode 3 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvmm b/openvmm index 350018ce4..770bc61e7 160000 --- a/openvmm +++ b/openvmm @@ -1 +1 @@ -Subproject commit 350018ce4335ba60ad722852f4004f90674f69e9 +Subproject commit 770bc61e7b2c683b092bffb5c8cd83b8696cf54a From 8a2595fe3acd5a264a6c1bf6eef2f4ad933eb403 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Wed, 25 Nov 2026 09:57:00 -0800 Subject: [PATCH 2/3] doc: map microVM restores of handles opened with access mode 3 in the 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> --- doc/openvmm-upstream-roadmap.md | 54 ++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/doc/openvmm-upstream-roadmap.md b/doc/openvmm-upstream-roadmap.md index 2847ea049..f662e4987 100644 --- a/doc/openvmm-upstream-roadmap.md +++ b/doc/openvmm-upstream-roadmap.md @@ -10,8 +10,9 @@ - Mapped fork tip: `c6e62f286b2879ca87da42e46de2fee887231d08`, position 126. The graph, PR summary, and commit mapping below cover positions 001-126, the PR20 fixups at positions 375 and 376, the PR25 fixup at position 377, and the PR18 fixup at position 389. -- NVX's pinned OpenVMM revision: `350018ce4335ba60ad722852f4004f90674f69e9`, position 389, the head - of microsoft/openvmm#5281, whose commit follows position 388, `1633b3797`, the head of +- NVX's pinned OpenVMM revision: `770bc61e7b2c683b092bffb5c8cd83b8696cf54a`, position 390, the head + of microsoft/openvmm#5282, whose commit follows position 389, `350018ce4`, the head of + microsoft/openvmm#5281, whose commit follows position 388, `1633b3797`, the head of `feature/microvm/dev` since microsoft/openvmm#5280 landed positions 386-388 on position 385, `043083f40`, where microsoft/openvmm#5279 had landed position 385 on position 384, `44747bf1c`, where microsoft/openvmm#5278 had landed position 384 on position 383, `fa239c823`, where @@ -34,9 +35,9 @@ commits that they fix, so each later commit's position is its v7.2 position less the number of those fixups before it; see [The v8.0 reorganization](#the-v80-reorganization). The tree of `899dcd63f` differs from the tree of `09524b79c` only in rustfmt's layout of two `virt_kvm` - tests. The pin is 263 commits past the mapped tip on the same first-parent chain. Positions - 127-374 and 378-388 are not yet assigned to PRs, positions 375 and 376 are PR20 fixups, position - 377 is a PR25 fixup, and position 389 is a PR18 fixup; see + tests. The pin is 264 commits past the mapped tip on the same first-parent chain. Positions + 127-374, 378-388, and 390 are not yet assigned to PRs, positions 375 and 376 are PR20 fixups, + position 377 is a PR25 fixup, and position 389 is a PR18 fixup; see [Commits after the mapped tip](#commits-after-the-mapped-tip). - Upstream main: `bf353460ff70e4a65627bb7003bed2cad1ce121f` (2026-11-21), the fork base; see [Upstream main past the fork base](#upstream-main-past-the-fork-base). @@ -1801,7 +1802,8 @@ bf353460f -> microVM listing bounds that count only the entries that the policy shows [385] -> gdb stub sessions that detach the debugger from the VM however they end [386-388] -> PR18 fixup [389] - -> 350018ce4 (NVX pin) + -> microVM restores of handles opened with access mode 3 [390] + -> 770bc61e7 (NVX pin) ``` For upstream review, PR01-PR03, PR05, PR06, and PR14 can be rebased independently onto current @@ -1838,7 +1840,7 @@ table never hands out `u64::MAX`, after that position's test of the largest next ## Commits after the mapped tip -The NVX pin extends the chain past position 126 without merges. Of its 263 later commits, positions +The NVX pin extends the chain past position 126 without merges. Of its 264 later commits, positions 375 and 376 are PR20 fixups, position 377 is a PR25 fixup, position 389 is a PR18 fixup, and the others are not yet classified or assigned to PRs. Each of positions 127-181 combines the v2.4 commits that the table lists, as v3.0 positions 145-160 @@ -1848,17 +1850,17 @@ of the v4.0 reorganization, positions 201-206 followed it, positions 207-213 fol reorganization, positions 214 and 215 followed the v5.1 rebase, positions 216-253 followed the v6.0 reorganization, positions 254-296 followed the v6.1 rebase, positions 297-314 followed the v7.0 reorganization, positions 315-331 followed the v7.1 rebase, positions 332-355 followed the -v7.2 rebase, and positions 356-389 followed the v8.0 reorganization, so they combine none, apart +v7.2 rebase, and positions 356-390 followed the v8.0 reorganization, so they combine none, apart from position 215, which combines v5.1 positions 222 and 223, and the commits that the v7.0 and v8.0 reorganizations folded into them. The table gives each commit's v7.2 position, which through position 301 is its own, since the v8.0 reorganization folded v7.2 positions 302, 316, 333, -335-340, 342, 345, 347, 349, 351, and 365, and which positions 356-389 lack. +335-340, 342, 345, 347, 349, 351, and 365, and which positions 356-390 lack. Each commit through v7.2 position 316 has the position that it had in v7.0 and v7.1, and each of v7.2 positions 317-334 is its v7.1 position less one, since the v7.2 rebase dropped v7.1 position 317, upstream's microsoft/openvmm#5160, which v7.1 had backported. Each commit's v6.1 position is its v6.0 position less seven, the number of commits that the v6.1 rebase dropped before it, and its v6.0 position is its v5.1 position through 147 and one less from v5.1 position 149 on, and -positions 297-389 have no position before v7.0; see +positions 297-390 have no position before v7.0; see [The v8.0 reorganization](#the-v80-reorganization), [Conflicts of the v7.2 rebase](#conflicts-of-the-v72-rebase), [The v7.0 reorganization](#the-v70-reorganization), @@ -2136,6 +2138,7 @@ whose first 269 commits are those of `feature/microvm/release/v6.1`, a v6.0 posi | 387 | `320e09cf5` | - | - | - | - | - | - | - | vmm_core: clear VP debug state on detach only if the debugger set it (microsoft/openvmm#5280) | | 388 | `1633b3797` | - | - | - | - | - | - | - | debug_worker: detach the debugger when its session ends (microsoft/openvmm#5280) | | 389 | `350018ce4` | - | - | - | - | - | - | - | virtiofs: let a new microVM object take the last node ID (microsoft/openvmm#5281); fold into 081, its test into 350 | +| 390 | `770bc61e7` | - | - | - | - | - | - | - | virtiofs: restore microVM handles opened with access mode 3 (microsoft/openvmm#5282) | The remarks that say whether commits apply to upstream main record what was found on upstream main when each commit was mapped: the v3.0 reorganization's base, `b2676222b`, for the commits that it @@ -2149,7 +2152,7 @@ for positions 325 and 326, `bf353460f`, upstream main on 2026-11-21 and the fork v8.0, for positions 327-355, `b50d0c979`, upstream main later on 2026-11-23, for position 356, `5d6ab1cfa`, upstream main later that day, for positions 357-368, `efe0b08df`, upstream main later still, for positions 369-375, and `8d4e03132`, upstream main on 2026-11-24, for positions -376-389. They name the positions that the commits have now, but neither +376-390. They name the positions that the commits have now, but neither the v8.0 reorganization and the v7.2 rebase, both on `bf353460f`, the v7.1 rebase on `9a875b563`, nor the v7.0 reorganization on `e6b458cc0` checked them again, nor did the v6.1 rebase check the earlier ones on `7d90c4104`. @@ -5872,6 +5875,35 @@ lacks the defect, since it lacks the microVM's limits, and replaying the commit `lib.rs`, whose `InodeReservation::insert` lacks position 081's check, and in the microVM's `limits.rs` and `fs_tests.rs`, which upstream main lacks, so it follows PR18 upstream. +Position 390 has a microVM restore reopen the virtio-fs handles that the guest opened with access +mode 3, which neither reads nor writes (microsoft/nvx#2125). Upstream's `FUSE_OPEN` accepts that +access mode, and upstream's `check_open_readonly` of `c06ecdde0` (microsoft/openvmm#2827) refuses on +a read-only node only the opens for `O_WRONLY` or `O_RDWR` or with `O_TRUNC`, the rule that position +334 names `opens_for_writing`, so a guest gets such a handle on a read-only share or child and, +under position 160's access policy, outside the writable paths too. PR18's position 083 saved the +handle's open flags, but its `reopen_flags` rejected access mode 3, and its restore refused on a +read-only profile every handle whose access mode is not `O_RDONLY`, a rule that position 160's +`writable_handle` extended to the writable paths, so a snapshot of a guest that held such a handle +saved but failed to restore. `reopen_flags` now keeps every access mode, and +`validate_microvm_state` takes a handle for a writable one as position 334's `opens_for_writing` +takes the open that reopens it, which drops `O_TRUNC`, so only `O_WRONLY` and `O_RDWR` need a +writable node. The saved state keeps its format. In the microVM's `state.rs`, which PR18's position +081 adds and PR18's positions 083 and 085, PR22's position 102, PR27's position 126, and positions +158, 160, 164, 165, 194, and 362 also change, it removes position 083's check from `reopen_flags` +and changes the line of position 160's `writable_handle`. It adds a test to the microVM's +persistence tests, after position 083's `readonly_profile_rejects_a_writable_saved_handle`, which +PR18's positions 081 and 083, PR22's position 102, and positions 164, 329-331, 335, 350, 354, 355, +362, 363, 367, 371, 385, and 389 also change; it builds its writable paths with position 160's +`from_attachment_with_policy`, uses the helpers that position 164 shares from the policy tests, and +expects the `EBADF` with which position 352's `write` refuses a handle not open for writing. It +fixes a defect of PR18's position 083, 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, unlike position 389, which it follows; of positions 372-389, only 385 and 389 change one of +its files, `fs_tests.rs`, where they add other tests, and position 389's imports are only context of +its own, so folding position 389 leaves it as it is. 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`, which upstream main lacks, so it cannot go upstream on its own. + ## PR summary Each count is of v8.0 commits, which include the fixups that the v3.0, v4.0, v5.0, v6.0, v7.0, and From 156fef3a7e2ebf6d4703c2f7e9b0b7d3e2ba8321 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Wed, 25 Nov 2026 08:32:38 -0800 Subject: [PATCH 3/3] doc: say which virtio-fs handles a restore treats as open for writing 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> --- doc/design/3.6-host-filesystem.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/design/3.6-host-filesystem.md b/doc/design/3.6-host-filesystem.md index 138a57d59..8b407f5f7 100644 --- a/doc/design/3.6-host-filesystem.md +++ b/doc/design/3.6-host-filesystem.md @@ -494,9 +494,9 @@ it: 2. Before the transport changes any state, the device validates the saved state: a known schema version, the fixed device shape, a FUSE session that the device would negotiate, at minor version 31 or newer, tables within - their bounds, unique IDs below the next IDs, and writable handles only - where the export or child is read-write and every name of the node is - writable. + their bounds, unique IDs below the next IDs, and handles open for writing, + whose access mode is `O_WRONLY` or `O_RDWR`, only where the export or child + is read-write and every name of the node is writable, as `OPEN` requires. 3. When the restored device first starts, before it services any request, the server rebuilds the node table with the saved node IDs and lookup counts. It resolves every recorded name beneath the supplied export without @@ -507,8 +507,10 @@ it: export goes on numbering every object without device keys. 4. The server reopens every handle with its saved open flags, except that it drops `O_CREAT`, `O_EXCL`, and `O_TRUNC`, so a restore never creates or - truncates a file. It verifies the identity and kind of each reopened object - and restores the handle's directory listing. + truncates a file. A handle thus keeps its access mode, even Linux's access + mode 3, which neither reads nor writes. The server verifies the identity + and kind of each reopened object and restores the handle's directory + listing. 5. The server restores the negotiated FUSE session without a new `INIT`. The guest then continues with its mount, working directories, open