Repository navigation
openvmm: pin directory listings that close a refused descriptor - #2220
Merged
Pedro Henrique Penna (ppenna) merged 2 commits intoNov 26, 2026
Merged
Conversation
lxutil's DirectoryEnumerator::new gave its descriptor to fdopendir as a raw descriptor, but fdopendir takes ownership only when it succeeds, so each listing of a descriptor that is not a directory, such as a virtio-fs FUSE_READDIR on a regular file's handle or a Plan9 Treaddir on a file's fid, failed with ENOTDIR and leaked the descriptor, and a guest could repeat it until OpenVMM ran out of descriptors (#2124). The microVM's file system refuses such a handle with its own S_IFDIR check before it reaches lxutil, so NVX's microVMs were not exposed. Pin microsoft/openvmm ee66d23117a9ebdd358686d8d9bacd1218d7dac0, the head of microsoft/openvmm#5293, one commit on 5f4a47b83, which NVX pins below this commit, a cherry-pick of microsoft/openvmm#5291's 7417a033b0e50aec3b16cac48f814441b0c7e47c, whose changed file it matches: - lxutil: close the descriptor when fdopendir fails in DirectoryEnumerator::new. The OwnedFd stays owned until fdopendir succeeds, so a failure drops and closes it. Its test, 200 listings of a regular file, fails at 5f4a47b83 on azure-intel-kvm-7 (Linux KVM, virtual machine) with "4 -> 204 descriptors open", and passes with the fix. At the pin, there, cargo check, clippy, and doc of lxutil and cargo xtask fmt pass, and nextest runs the 324 tests of lxutil, virtiofs, and plan9, which all pass. 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>
…enVMM roadmap Map position 399, the commit of microsoft/openvmm#5293, which NVX now pins at ee66d2311, 273 commits past the mapped tip, on 5f4a47b83, position 398, the head of feature/microvm/dev since microsoft/openvmm#5283-#5290 landed positions 391-398: - 399, lxutil: close the descriptor when fdopendir fails in DirectoryEnumerator::new. The constructor keeps its OwnedFd until fdopendir succeeds, so a listing of a descriptor that is not a directory, which upstream's virtio-fs FUSE_READDIR and Plan9 Treaddir reach, no longer leaks it (#2124). Position 399 is not assigned to a PR, and no chain commit changes the file that it changes. It is a cherry-pick of microsoft/openvmm#5291's 7417a033b, which proposes it on upstream main 8d4e03132, where lxutil type-checks and its tests pass on azure-intel-kvm-7, so it can go upstream on its own. The Scope now records that positions 391-398 landed on feature/microvm/dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the OpenVMM pin and roadmap updates.
No open issues 🎉
What changed in this PR
Pins OpenVMM to a fix for #2124 that closes descriptors when Unix directory enumeration fails, and updates NVX’s upstream roadmap to track the change.
Changes:
- Advances the OpenVMM pin to
ee66d2311from microsoft/openvmm#5293. - Maps position 399 across the roadmap and records positions 391–398 as landed.
- Documents the fix’s upstream origin, affected callers, regression coverage, and why microVMs were not exposed to the leak.
| File | Description |
|---|---|
doc/openvmm-upstream-roadmap.md |
Updates the pin, chain counts, diagram, commit mapping, and descriptor-leak fix details. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-2124-lxutil-fdopendir-leak
branch
November 26, 2026 19:54
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 #2124
What does this pull request change?
Pins OpenVMM at
ee66d23117a9ebdd358686d8d9bacd1218d7dac0, the head of microsoft/openvmm#5293, whose one commit keepslxutil's UnixDirectoryEnumerator::newfrom leaking a descriptor thatfdopendirrefuses, and maps it as position 399 in the OpenVMM upstream roadmap.openvmm: pin directory listings that close a refused descriptor: the gitlink only.doc: map directory listings that close a refused descriptor in the OpenVMM roadmap: position 399 in the Scope, the DAG, the commits table, and its remarks; the Scope also records that [DO NOT REVIEW] lxutil: reject xattr names longer than an NTFS EA name allows openvmm#5283-#5290 landed positions 391-398 onfeature/microvm/dev.The OpenVMM commit is a cherry-pick of upstream's microsoft/openvmm#5291 (
7417a033b, by Jitendra Bansal (@Jbansal2)), whose changed file it matches byte for byte. Start the review atvm/devices/support/fs/lxutil/src/unix/util.rsin microsoft/openvmm#5293. Nothing innvx, the guest, or the host tooling changes.Why is this change needed?
DirectoryEnumerator::newpassedfd.into().into_raw_fd()tofdopendir, which takes ownership of a descriptor only when it succeeds. For a descriptor that is not a directory it fails withENOTDIR, and nothing closed the raw descriptor. Upstream's virtio-fsFUSE_READDIRon a regular file's handle (LxFile::read_dirgives it a duplicate) and Plan9Treaddiron a file's fid both reach it, so a guest could repeat the request until OpenVMM ran out of descriptors. The fix keeps theOwnedFduntilfdopendirsucceeds and only then releases it to theDIR*, whichclosedircloses inDrop.NVX's microVMs were not exposed: the microVM's listing,
build_microvm_directory_snapshot_within, checksS_IFDIRand refuses withENOTDIRbefore it opens a directory stream. The pin still matters because NVX ships this OpenVMM and every successful listing goes through the changed constructor.Alternatives: the issue's suggested patch is the same change as microsoft/openvmm#5291, so it is taken as proposed. A directory check in
VirtioFs::read_diralone would leave the Plan9 path and any other caller leaking, so the fix belongs in the constructor that owns the descriptor.How was this change validated?
Checks and results:
azure-intel-kvm-75f4a47b83(base) + the test onlycargo test -p lxutil --lib directory_enumerator_on_non_directory200 failed enumerations: 4 -> 204 descriptors openazure-intel-kvm-7ee66d2311(pin)azure-intel-kvm-7ee66d2311cargo check -p lxutil;cargo clippy --all-targets -p lxutil -- -D warnings;cargo doc --no-deps -p lxutil;cargo xtask fmtazure-intel-kvm-7ee66d2311cargo nextest run --profile agent -p lxutil -p virtiofs -p plan9azure-intel-kvm-77417a033bon8d4e03132cargo check -p lxutil;cargo test -p lxutil --libazure-intel-kvm-75018b2c80, OpenVMM built at the pinpython3 scripts/nvx.py test-microvm --backend kvm --scenario filesystem-shares --scenario filesystem-snapshot --scenario platform-aggregate-export5018b2c80python scripts/local_gates.py --base origin/dev --run5018b2c80python scripts/openvmm_pin.py check-roadmap --worktree;python scripts/openvmm_pin.py check-branch --topicBackend, host OS, host type, and guest:
azure-intel-kvm-7is Linux KVM (Azure Linux 3.0), a virtual machine; the microVM scenarios used the Alpine guest and the artifacts of releasev0.1.0-dev.5cf6a6950684, withopenvmmrebuilt at the pin (SHA-256d2209407…→9fa25177…).Left to CI: the microVM scenarios on MSHV and WHP and the rest of the KVM suite, which the gitlink selects, and OpenVMM's own CI of the pin. NVX run 45851494234 of
5018b2c80passed, including KVM, MSHV, and WHP and theopenvmm-cijob.OpenVMM's run 45846860334 of the pin passed
openvmm checkin gates, the unit tests, and every Linux and Windows vmm-tests job except two Windows Hyper-V OpenHCL jobs, which cannot reach Unix-onlylxutil:x64-windows-intel-tdxlost its test node ("remote node disconnected") and passed on the one rerun.x64-windows-amd-snp, which is not required, failedvmgstool_copy_igvmfilein both attempts because the Hyper-V VM "failed to start". The same test fails in the SNP jobs of unrelated OpenVMM pull requests (runs 45732387857, 45720932312, 45686974502, and 45681589406), and SNP also fails, on other tests, in the base5f4a47b83's runs 45744513828 and 45669616533.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.
OpenVMM pin
ee66d23117a9ebdd358686d8d9bacd1218d7dac0, one commit on5f4a47b83, the current head offeature/microvm/dev, signed (verified byopenvmm_pin.py source).-x) of lxutil: close the descriptor when fdopendir fails in DirectoryEnumerator::new openvmm#5291's7417a033b0e50aec3b16cac48f814441b0c7e47c, which proposes the same change upstream onmain;git diff 7417a033b ee66d2311 -- vm/devices/support/fs/lxutil/src/unix/util.rsis empty.nvxcopies are unchanged.feature/microvm/devto exactlyee66d23117a9ebdd358686d8d9bacd1218d7dac0(python3 scripts/openvmm_pin.py land ee66d23117a9ebdd358686d8d9bacd1218d7dac0 --remote REMOTE --push), not with the merge button, which squashes; then merge this pull request.