Skip to content

openvmm: pin microVM aggregate restores that refuse the root's node ID - #2158

Merged
Pedro Henrique Penna (ppenna) merged 3 commits into
devfrom
agents/issue-2134-virtiofs-aggregate-next-node
Nov 26, 2026
Merged

Pedro Henrique Penna (ppenna) merged 3 commits into
devfrom
agents/issue-2134-virtiofs-aggregate-next-node

Conversation

@ppenna

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

Copy link
Copy Markdown
Contributor

Fixes #2134

Stacked on #2156 (agents/issue-2133-virtiofs-unreachable-entries), itself stacked on #2155 and the pull requests below it; only the top three commits belong to this pull request (see OpenVMM pin for the landing order).

What does this pull request change?

A microVM restore now refuses an aggregate's saved state whose next node ID is 1, the node of the aggregate's synthetic root. Before, a state whose node table was empty and whose next node ID was 1 restored, and the restored device then gave node 1 to the first child that the guest looked up: the device routed every request for that node to the synthetic root, so the guest's listing of the child showed the aggregate's children instead of the child's files, and the device's next save failed to restore with "saved aggregate inode table contains the synthetic root". The device never saves such a state, since an aggregate numbers its nodes from 2, so only a corrupt or crafted snapshot reaches this; every state that the device saves still restores.

The fix is in OpenVMM, microsoft/openvmm#5290, which this pull request pins:

  • virtiofs: refuse a microVM aggregate state whose next node ID is 1. validate_microvm_state (vm/devices/virtio/virtiofs/src/microvm/state.rs), which the device's saved-state validator and restore_microvm_state run before they change any state, requires the next node ID to exceed FUSE_ROOT_ID as well as every saved node ID. One test in microvm/aggregate_fs_tests.rs.

The NVX commits are the gitlink-only pin; the mapping of the commit, position 398, in the OpenVMM roadmap; and step 2 of Restore, which now says that the device requires a next node ID above the root's, even for an aggregate, which saves no node for its synthetic root. Start with the OpenVMM diff: git diff --submodule=diff origin/agents/issue-2133-virtiofs-unreachable-entries...HEAD.

Left out and limitations:

  • Nothing changes for a single share, whose saved root is node 1, so that its next node ID already had to exceed 1.
  • The saved state keeps its format, and no version changes.

Why is this change needed?

A restore must refuse a state that would break the device's invariants rather than restore a device that misroutes the guest's requests and saves a state that no restore accepts. Node 1 is the root of every attachment, and an aggregate's synthetic root holds it without a saved node.

Root cause: position 164 of the microVM chain (d109f3e89, microVM: share several host directories through one virtio-fs slot, which no PR of the OpenVMM roadmap maps yet) made microVM aggregates save no node for their synthetic root, node 1, but kept the check of PR18's position 083 (6315c16c5) that the next node ID exceed the saved node IDs only, which covered node 1 while every state saved its root as node 1. Position 083's restore_microvm_state makes the saved value the node table's next ID, and upstream's aggregate (microsoft/openvmm#3821) routes every request for node 1 to its synthetic root.

The issue's suggested patch, state.next_node_id > largest_node_id.max(FUSE_ROOT_ID), is the fix, and the test below confirms it.

Alternative rejected: refusing node 1 where the node table allocates IDs. The restore would still accept a state that no device saves, and the device would then fail or skip lookups, instead of the restore failing before it changes anything.

How was this change validated?

Checks and results. "Before" is OpenVMM 1633b3797, the head of feature/microvm/dev; "after" is the fix, as 2f85df783 on 1633b3797 and, after its rebase onto microsoft/openvmm#5289, as the pinned 5f4a47b83, whose patch git range-diff reports equal. Windows is the local Windows 11 Enterprise (build 26300, NTFS) workstation, and Linux the azure-intel-kvm-7 test VM (Azure Linux 3, kernel 6.18, x86_64, tmpfs), since python scripts/nvx_hosts.py select kvm --host-type virtual-machine chose a runner-only host without a Rust toolchain.

Check Before After
cargo nextest run --profile agent -p virtiofs -E 'test(children_never_get_the_synthetic_root_node)' (new test), Windows and Linux fails on both: the restore with a next node ID of 1 succeeds passes on both, at 2f85df783 and at 5f4a47b83
A one-off test, not committed, on Windows: restore an empty aggregate state with a next node ID of 1, look up the child work, list it, save, and restore the save the restore succeeds; work gets node 1, and its listing shows the aggregate's children tools and work; the save's restore fails with "saved aggregate inode table contains the synthetic root"
cargo check, cargo clippy --all-targets, and cargo doc --no-deps, each -p virtiofs no warnings on Windows and Linux, at 2f85df783 and at 5f4a47b83
cargo nextest run --profile agent -p virtiofs at 5f4a47b83: Windows 250 passed, 3 skipped; Linux 250 passed, 1 skipped. At 2f85df783: Windows 241 passed, 3 skipped; Linux 242 passed, 1 skipped
cargo xtask fmt --fix no changes, at 2f85df783
cargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignored, and the same with --test openvmm_cpu_profiles pass, 4 and 1 tests: the vectors and CPU profiles that nvx copies are unchanged
python scripts/openvmm_pin.py source 5f4a47b83591ccbcc4f9a2563b5322603def625b --pr 5290 good signature; the pull request's head
python scripts/openvmm_pin.py check-branch --topic --target origin/agents/issue-2133-virtiofs-unreachable-entries, python scripts/openvmm_pin.py check-roadmap --worktree, python scripts/check_markdown_links.py, git diff --check pass; the three commits are signed
python scripts/local_gates.py --base origin/agents/issue-2133-virtiofs-unreachable-entries --run --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles all pass; no change to existing tests
python scripts/local_gates.py --base origin/dev --run --only nvx-cli, before the rebase, with the design-document commit on fb28ca4c3 2,322 tests, one failure and one error on this loaded workstation: test_private_network_ingress_script_checks_policy_and_traffic timed out its guest script after 10 s, and test_snapshot_core_detects_regressions_of_snapshots_and_their_restores (fault waiters-share-the-lock) raised no error; both pass when run alone. Neither this branch nor the branches below it change a script
A code-review agent on the whole diff no findings

After the base branch was rebuilt, from c3f4c024a to 9f5bae739, the three commits were rebuilt on it, the roadmap commit on the base's text, which now classifies positions 389, 393, and 396 as PR18 fixups; at 71c5f47ac, python scripts/openvmm_pin.py roadmap 5f4a47b83591ccbcc4f9a2563b5322603def625b --target origin/agents/issue-2133-virtiofs-unreachable-entries (position 398, 272 commits past the mapped tip), check-roadmap --worktree, check-branch --topic, git diff --check, and the local gates of the table pass again.

Backend, host OS, host type, and guest: KVM on azure-intel-kvm-7 (Azure Linux 3, kernel 6.18, x86_64), a virtual machine, with the Alpine guest and kernel of release v0.1.0-dev.fb28ca4c3f07. OpenVMM was built from 2f85df783 and from 5f4a47b83 with python3 scripts/nvx.py build-openvmm --backend kvm, whose provenance recorded a clean checkout, and python3 scripts/nvx.py test-microvm --backend kvm --scenario filesystem-snapshot --scenario platform-aggregate-export --scenario filesystem-shares passed with both. NVX always exports an aggregate, so these scenarios' snapshots restore aggregate states through the changed check. No scenario crafts the state that the fix refuses, so the unit test above is the reproduction.

OpenVMM's CI of the pin, run 45669616533, passed its six required jobs: 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, as python scripts/nvx.py check-openvmm-ci --revision 5f4a47b83591ccbcc4f9a2563b5322603def625b reports.

Left to CI: NVX CI's KVM, MSHV, and WHP microVM jobs with OpenVMM built from the pin, MSHV and WHP among them, which no host here ran, and its NVX CLI jobs. CI of the previous head, 1428892d2, passed them all in run 45672415550, whose WHP benchmark job waits for the shared WHP benchmark runner.

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.

Changes to existing tests

None: python scripts/check_test_changes.py --base origin/agents/issue-2133-virtiofs-unreachable-entries lists no change to an existing test, and the OpenVMM pull request adds one test and changes none.

OpenVMM pin

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 block the documentation updates for the aggregate-snapshot restore validation fix.

No open issues 🎉

What changed in this PR

This PR integrates the OpenVMM fix for #2134 into NVX, rejecting malformed aggregate snapshots whose next node ID would reuse the synthetic root’s reserved ID.

Changes:

  • Records OpenVMM revision 5f4a47b83 at roadmap position 398, including its dependencies and fix rationale.
  • Documents that restore requires the next node ID to exceed the root’s ID, without changing the saved-state format.
File Description
doc/​openvmm-upstream-roadmap.md Updates the pin, chain counts, and mapping for the aggregate-restore fix.
doc/​design/​3.6-host-filesystem.md Clarifies the next-node-ID requirement during restore validation.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) force-pushed the agents/issue-2133-virtiofs-unreachable-entries branch from c3f4c02 to 9f5bae7 Compare November 25, 2026 19:40
A microVM aggregate's saved state whose node table was empty and whose
next node ID was 1, FUSE_ROOT_ID, restored (#2134). Node 1 of an
aggregate is its synthetic root, which has no saved node, so the next
lookup of a child gave the child's root node 1, the device routed every
request for that node to the synthetic root, and the device's next save
could not restore. The device never saves such a state, so only a
corrupt or crafted state reaches this.

Pin microsoft/openvmm 5f4a47b83591ccbcc4f9a2563b5322603def625b, the head
of microsoft/openvmm#5290, one commit on a79b4bb40, the head of
microsoft/openvmm#5289, which NVX pins below this commit:

- virtiofs: refuse a microVM aggregate state whose next node ID is 1.
  validate_microvm_state, which the device's saved-state validator and
  restore_microvm_state run before they change any state, requires the
  next node ID to exceed FUSE_ROOT_ID as well as every saved node ID,
  which changes nothing for a single share, whose root is its saved
  node 1. Its test fails without the fix, since the restore succeeds,
  and passes with it, on Windows and on Linux. At the pin, the tests of
  the virtiofs package pass on Windows and Linux, and NVX's
  filesystem-snapshot, platform-aggregate-export, and filesystem-shares
  microVM scenarios pass on KVM.

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>
…nVMM roadmap

Map position 398, the commit of microsoft/openvmm#5290, which NVX now
pins at 5f4a47b83, 272 commits past the mapped tip, on a79b4bb40,
position 397, the head of microsoft/openvmm#5289:

- 398, virtiofs: refuse a microVM aggregate state whose next node ID
  is 1. validate_microvm_state requires the next node ID to exceed
  FUSE_ROOT_ID as well as every saved node ID, so that a restore no
  longer accepts an aggregate state without nodes whose next node ID
  is that of the synthetic root, which has no saved node, and then
  gives the synthetic root's node to the first child that the guest
  looks up (#2134).

Position 398 is not yet assigned to a PR: it fixes a defect of
position 164, which no PR maps, since PR18's position 083's check of
the next node ID held as long as every state saved its root as node 1,
which position 164's aggregates do not, so it is not a PR18 fixup,
unlike positions 389, 393, and 396. Of positions 372-397, only 390,
393, and 396 change its files, all three the microVM's state.rs's
reopen_flags, and position 390 also the check of writable handles
after the check that it changes. 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
aggregate_fs_tests.rs, which upstream main lacks, so it cannot go
upstream on its own.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The host filesystem's description of a restore said that the device
requires unique IDs below the next IDs, but not that the next node ID
must also pass node 1, the root's. A single share saves its root as
node 1, so its next node ID passed the root anyway, but an aggregate
saves no node for its synthetic root, and OpenVMM accepted an aggregate
state without nodes whose next node ID was 1, which gave the synthetic
root's node to the first child that the guest looked up (#2134). The
pinned OpenVMM refuses that state.

Say that a restore requires a next node ID above the root's, even for
an aggregate, which saves no node for its synthetic root.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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 documentation updates clarifying the reserved-root node ID requirement.

No open issues 🎉

Review effort: Balanced

Base automatically changed from agents/issue-2133-virtiofs-unreachable-entries to dev November 26, 2026 02:43
@ppenna
Pedro Henrique Penna (ppenna) added this pull request to the merge queue Nov 26, 2026
Merged via the queue into dev with commit 0d2ea37 Nov 26, 2026
51 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/issue-2134-virtiofs-aggregate-next-node branch November 26, 2026 03:23
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.

virtio-fs microVM: aggregate restore accepts the synthetic root's reserved node ID as the next node ID

2 participants