Repository navigation
openvmm: pin the refusal of aggregate root reads too small for an entry - #1947
Merged
Pedro Henrique Penna (ppenna) merged 3 commits intoNov 22, 2026
Merged
Conversation
OpenVMM's virtio-fs server answered a FUSE_READDIR or FUSE_READDIRPLUS of an aggregate's synthetic root whose buffer could not hold the next entry with an empty reply, which the guest takes for the end of the directory (#1617). A read from the start with a buffer too small for `.` therefore listed an empty root, and a listing whose buffer held the entries before a child with a longer name ended before that child, without an error. The reads of every other directory fail with EINVAL, as getdents64 does. Pin microsoft/openvmm 189dc519ffcf30c5b9cfea4805e5b917c1556b1b, one commit on 2a483a06f, the head of microsoft/openvmm#5215: - virtiofs: fail a synthetic root read too small for its next entry. The read fails with EINVAL when the first entry that it reaches does not fit. A read that fits some entries still returns them, and a read at the end of the root still returns an empty reply. Its test fails without the change on Windows and on Linux (nvx-mshv-test). NVX's Linux guest reads directories with buffers of at least a page, which holds any entry, so the microVM behaves as it did. 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>
The host filesystem's description of the request path said how large a buffer a READDIR or READDIRPLUS may ask for, but not what a read whose buffer cannot hold the next entry returns. The server answered such a read of an aggregate's root with no entries, which the guest takes for the end of the directory, so the guest listed the root without the children from that entry on (#1617), while it fails such a read of any other directory with EINVAL, as getdents64 does. The pinned OpenVMM fails the root's read with EINVAL too. Say that a READDIR or READDIRPLUS whose buffer cannot hold the next entry fails with EINVAL rather than return no entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Map position 350, the commit of microsoft/openvmm#5216, which NVX now pins at 189dc519f, 224 commits past the mapped tip: - 350, virtiofs: fail a synthetic root read too small for its next entry. VirtioFs::read_synthetic_root_dir_with fails a FUSE_READDIR or FUSE_READDIRPLUS of an aggregate's synthetic root whose buffer cannot hold the next entry with EINVAL, as the reads of every other directory do. It returned an empty reply, which the guest takes for the end of the directory, so the guest listed the root without the children from that entry on. Position 350 is not yet assigned to a PR. It changes only the !fit branch of upstream's loop from a5f055dd7 (microsoft/openvmm#3821), which no chain commit changes, and adds a test to upstream's aggregate_tests.rs; it changes nothing that a mapped PR adds, so it is no fixup. Upstream main, bf353460f, has the defect. The commit applies there as it is, and on the merged tree virtiofs type-checks with its tests, the new test fails without the change, and all 72 tests of the package pass with it, on Windows, so it can go upstream on its own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 tasks done
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The review has no active issues for the OpenVMM pin update and accompanying directory-read documentation.
No open issues 🎉
What changed in this PR
This PR advances NVX’s OpenVMM pin to 189dc519f to address #1617: aggregate-root directory reads return EINVAL when entries remain but none fit, rather than falsely signaling end-of-directory. Partial reads and genuine end-of-directory replies remain unchanged.
Changes:
- Documents the undersized-buffer behavior for
READDIRandREADDIRPLUS. - Updates the OpenVMM roadmap to position 350, including the new pin, chain counts, and upstream applicability.
| File | Description |
|---|---|
doc/openvmm-upstream-roadmap.md |
Maps the new pin and explains the fix, test coverage, and upstream applicability. |
doc/design/3.6-host-filesystem.md |
Documents EINVAL for directory-read buffers too small to hold an entry. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-1617-synthetic-root-einval
branch
November 22, 2026 07:43
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 #1617
What does this pull request change?
It pins OpenVMM
189dc519f(microsoft/openvmm#5216), one commit on top of the pin of #1946, in which OpenVMM's virtio-fs server fails aFUSE_READDIRorFUSE_READDIRPLUSof an aggregate's synthetic root whose buffer cannot hold the next entry withEINVAL, as it already fails such a read of any other directory, rather than return an empty reply, which the guest takes for the end of the directory. Stacked on #1946 (#1620); only the top three commits belong to this pull request.VirtioFs::read_synthetic_root_dir_withstopped at the first entry that did not fit and returned what it had written, even nothing. A read from the start with a buffer too small for.(at most 31 bytes forREADDIR, 159 forREADDIRPLUS) listed an empty root, and a listing whose buffer held the entries before a child with a longer name ended before that child without an error.EINVAL. A read that fits some entries still returns them, and a read at the end of the root still returns an empty reply, even with a buffer too small for an entry.READDIRPLUSchecks that an entry fits before it looks the child up, so the failed read takes no lookup reference.Three commits:
openvmm: pin the refusal of aggregate root reads too small for an entry: the gitlink only.doc: say that directory reads refuse buffers too small for an entry: one sentence in section 3.6.3 ofdoc/design/3.6-host-filesystem.md, next to the 1 MiB bound of directory reads.doc: map undersized aggregate root reads in the OpenVMM roadmap: position 350.Start with the OpenVMM commit: the
!fitbranch invm/devices/virtio/virtiofs/src/aggregate.rsand its test inaggregate_tests.rs.Left out, tracked separately:
FSYNCDIRon the synthetic root (#1624), the handle map'su64::MAXandSYNTHETIC_ROOT_FH(#1627), and the root'sst_nlink(#1632).Why is this change needed?
FUSE defines an empty
READDIRorREADDIRPLUSreply as the end of the directory: Linux'sfuse_readdir_uncachedreturns 0 togetdents64for it. Upstream's aggregate support (microsoft/openvmm#3821) wrote the synthetic root's loop tobreakon the first entry that did not fit and return its buffer, even when empty, whileVirtioFsFile::read_dir_withandread_dir_microvmfail a read that fits none of the remaining entries withEINVAL, asgetdents64does. A FUSE client with a small buffer therefore saw a truncated root, without an error. The Linux FUSE client reads directories with buffers of at least a page, which holds any entry, so NVX's Linux guest sees no change; the fix makes the root keep the contract of every other directory for any client.The issue's suggested patch tracked a
fullflag and returnedEINVALafter the loop; this change returns it in the!fitbranch when nothing was written, which is the same condition. The issue's test was an integration test on a microVM aggregate; the test here is a unit test among the aggregate's own tests, on an aggregate built with upstream'sVirtioFs::new_aggregate, so that the commit applies to upstreammainon its own, which has the same defect.How was this change validated?
Checks and results:
cargo nextest run --profile agent -p virtiofs -E 'test(synthetic_root_refuses_a_buffer_too_small_for_the_next_entry)'with the fix reverted (Windows 11, local)aggregate_tests.rs:365:plus: false,left: None,right: Some(Error(EINVAL (22))), the listing ending afterworknvx-mshv-test(Azure Linux 3.0 VM, kernel 6.18)cargo check,cargo clippy --all-targets,cargo doc --no-deps -p virtiofsat189dc519f, Windows andnvx-mshv-testcargo nextest run --profile agent -p virtiofsat189dc519fnvx-mshv-test: 206 passed, 1 skippedcargo xtask fmt --fix(OpenVMM)mainbf353460f(merged tree):cargo check -p virtiofs --tests, the new test without and with the fix,cargo nextest run -p virtiofs(Windows)python scripts/nvx.py test-microvm --backend kvm --scenario filesystem-shares --scenario platform-aggregate-export --scenario platform-filesystem --scenario filesystem-snapshotat this head, with OpenVMM built from189dc519fcargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignoredand--test openvmm_cpu_profiles -- --ignorednvxcopies changespython scripts/local_gates.py --base origin/agents/issue-1620-rename-hardlinks --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles nvx-cli --run(Windows)nvx-cli: 2314 tests OK (89 skipped), 84 adversarial tests OK (11 skipped)python scripts/openvmm_pin.py source 189dc519f --pr 5216python scripts/openvmm_pin.py check-branch --target origin/agents/issue-1620-rename-hardlinks --topic,check-roadmap --worktree,python scripts/check_markdown_links.py,python scripts/nvx.py verifyBackend, host OS, host type, and guest: KVM on
nvx-kvm-test, an Azure Linux 3.0 virtual machine, Alpine guest.Left to CI: the WHP and MSHV microVM suites and the rest of the KVM matrix, benchmarks, and
openvmm-ci, which waits for OpenVMM's CI of189dc519fon microsoft/openvmm#5216.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-rs/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.
The OpenVMM test is new and no existing test changes (
check_test_changes.py --base origin/agents/issue-1620-rename-hardlinks: 0 changes).nvxitself does not change. No saved state, protocol, ABI, or on-disk format changes, and no version of any of them is created or bumped.OpenVMM pin
[DO NOT REVIEW] virtiofs: fail a synthetic root read too small for its next entry.189dc519ffcf30c5b9cfea4805e5b917c1556b1b, signed, the pull request's head; one commit on2a483a06f, the head of [DO NOT REVIEW] virtiofs: keep node names when renaming one hard link onto another openvmm#5215 (openvmm: virtiofs: renaming one hard link onto another hard link of the same file drops the source alias #1620).agents/issue-1620-rename-hardlinks), and [DO NOT REVIEW] virtiofs: fail a synthetic root read too small for its next entry openvmm#5216 on [DO NOT REVIEW] virtiofs: keep node names when renaming one hard link onto another openvmm#5215, which stack on the layers below them.mainon its own.feature/microvm/devto189dc519f, not with the merge button, which squashes, and then merge this pull request.