Skip to content

[DO NOT REVIEW] virtiofs: count only shown entries toward a microVM listing's bound - #5279

Merged
Pedro Henrique Penna (ppenna) merged 8 commits into
feature/microvm/devfrom
copilot/nvx-issue-2093-virtiofs-hidden-entries
Nov 25, 2026
Merged

Pedro Henrique Penna (ppenna) merged 8 commits into
feature/microvm/devfrom
copilot/nvx-issue-2093-virtiofs-hidden-entries

Conversation

@ppenna

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

Copy link
Copy Markdown
Contributor

Refs microsoft/nvx#2093.

Stacked on #5278: this branch holds its commit, 44747bf1c, which follows the head of feature/microvm/dev, fa239c823, directly, and one commit of its own on top of it, 043083f40. Review only that last commit; #5278 covers the other.

NVX pins the head of this branch, 043083f4059c7dfda9d021a8cf983ac65017c91e, in microsoft/nvx#2120, which is stacked on microsoft/nvx#2119, the NVX pull request of microsoft/nvx#1909 (branch agents/issue-1909-io-uring-start). This pull request is therefore a prerequisite of that NVX change. It lands after #5278, by fast-forwarding feature/microvm/dev to that exact commit, not with the merge button, which squashes.

What and why

A microVM virtio-fs directory listing that already held 4,096 entries, . and .. included, failed with E2BIG when the host listed another entry that the share's access policy hides, although the guest never sees that entry. The same directory listed all 4,096 entries when the host listed the hidden entries first, so whether the first FUSE_READDIR or FUSE_READDIRPLUS of a handle failed depended on the host's enumeration order, which the guest cannot control. A guest's busybox ls -a of such a share printed nothing.

VirtioFsFile::build_microvm_directory_snapshot (vm/devices/virtio/virtiofs/src/microvm/file.rs) checked the per-handle bound of 4,096 entries at the top of its read_dir callback, before the name check and the access-policy filter, so a hidden entry counted toward the bound as if it were listed. The check now runs where an entry is about to join the listing, after the filter, beside the check of the 64 KiB bound on names, which already ran there. Only the entries that the guest can list count toward either bound, and a 4,097th of them still fails the listing with E2BIG.

The builder now lists through build_microvm_directory_snapshot_within, which takes the entry bound as a parameter, so that a test can pass a smaller one. A test at the real bound needs a directory of more than 4,096 entries, which takes seconds to create on Windows, past the 1 s after which the CI test profile calls a test slow.

Left as it is: an entry whose name the name check rejects, an empty name or one longer than 255 bytes, still fails the listing with EINVAL before the policy filter runs, whether or not the policy hides it.

No saved state, protocol, ABI, or format, and no version of any of them, changes; a handle's listing keeps its format and its bounds.

Tests

microvm_listings_count_only_the_entries_that_the_policy_shows (microvm/fs_tests.rs) hides each of three files in turn, so that one of them is the last that the host lists, whatever its order, and expects a bound of four entries to hold ., .., and the two shown files, and a bound of three to fail with E2BIG.

Validation

With the fix on d44a113be, the head of feature/microvm/dev before this stack, on Windows 11 Enterprise (build 26300, NTFS) and on nvx-kvm-test (Azure Linux 3, kernel 6.18, x86_64, KVM):

  • Before, the new test fails with E2BIG for the file that the host lists last, c on NTFS and a on tmpfs; after, it passes on both.
  • A one-off test, not committed, fills a handle's listing with 4,094 shown files and hides one more. Before, the first FUSE_READDIR and FUSE_READDIRPLUS of the root fail with E2BIG when the hidden file is the last that the host lists, and list all 4,096 entries when it is the first; after, they list all 4,096 entries in both cases, and 4,095 shown files still fail with E2BIG.
  • cargo check, cargo clippy --all-targets, and cargo doc --no-deps of virtiofs have no warnings, and cargo nextest run --profile agent -p virtiofs passes 240 tests on Windows (3 skipped) and 242 on Linux (1 skipped). cargo xtask fmt --fix changes nothing.
  • On KVM, a guest ls -a of a share of 4,095 files on ext4 whose policy hides the last file that the host lists printed no name with the release OpenVMM of d44a113be, and 4,096 names with OpenVMM built from the fix, which also passes NVX's filesystem microVM scenarios: filesystem-shares, filesystem-snapshot, filesystem-policy, filesystem-owner, denied-filesystem-paths, filesystem-comma-paths, platform-filesystem, and platform-aggregate-export. On WHP, on Windows 11 (NTFS), the same ls -a printed no name with that release OpenVMM, and 4,096 names with OpenVMM built from this branch's head.

The rebase onto #5278 applied without conflicts and left the patch unchanged, as git range-diff reports. The commits below it change pal_async and vmcore, on which virtiofs depends, so the package's checks ran again on Windows on this head: cargo clippy --all-targets -p virtiofs has no warnings, and cargo nextest run --profile agent -p virtiofs passes 240 tests (3 skipped). CI's unit tests build and run it on Linux and Windows.

CI's first attempt lost run vmm-tests [x64-linux-amd-kvm] to the 600 s timeout of multiarch::pcie::openvmm_uefi_x64_windows_datacenter_core_2025_x64_virtio_net_kdnet_windows, a Windows guest whose frame buffer stopped changing, a test that this change does not reach and that the same job passed for #5278; one rerun of the failed jobs passed it. run vmm-tests [x64-windows-amd-snp] fails for #5277 and #5278 too.

TopologyBuilder::from_cpuid stored the VPs per socket that it derives
from the host's CPUID without checking them against the range of 1 to
32768 that the vps_per_socket setter clamps to (microsoft/nvx#1378). A
host whose leaf 0Bh core level has an x2APIC shift of 16 or more gave
65536 or more VPs per socket, and topology_cpuid then panicked with
"value out of bounds [0, 15]" encoding them into an AMD guest's leaf
80000008h, whose ApicIdCoreIdSize holds the log2 of a socket's reserved
VPs in 4 bits. An AMD host without leaf 0Bh, whose leaf 80000008h
counts one thread and whose leaf 8000001Eh has a ThreadsPerComputeUnit
of 2, gave 1 / 2 = 0, and build() then panicked with "attempt to divide
by zero". Both panic in debug and release builds. The standard machine
and OpenHCL start from the host's topology, through
from_host_topology; the microVM starts from new_x86() and is not
affected.

from_cpuid now refuses a count outside that range with the new error
UnsupportedVpsPerSocket, so such a host's VM fails to start with that
error instead of panicking later. It refuses the count rather than
clamping it, so that the topology never silently differs from the
host's, as it already refuses more than two threads per core with
UnsupportedThreadsPerCore. MAX_VPS_PER_SOCKET now names the range's
upper bound for the setter and from_cpuid alike, and the setter
documents its clamp.

Tests, in a new tests module of the x86 topology, feed from_cpuid
synthetic host CPUID; vm_topology gains test_with_tracing as a
dev-dependency for them. host_vps_per_socket_above_the_range_are_refused
checks that an Intel host with a core-level shift of 16 is refused with
65536 and that one with a shift of 15 builds a topology of 32768 VPs per
socket. host_vps_per_socket_below_the_range_are_refused checks that the
AMD host above is refused with 0 and that one whose leaf 80000008h
counts two threads builds a topology of 1. At feature/microvm/dev
d44a113, both fail, from_cpuid accepting both hosts; both pass
with the fix.

A scratch test, not committed, ran these hosts through virt's
topology_cpuid. At d44a113, the Intel host's topology panicked
there for an AMD guest with "value out of bounds [0, 15]", and the AMD
host's build(1) with "attempt to divide by zero", in the dev and
release profiles. With the fix, from_cpuid refuses both hosts, and a
host with 32768 VPs per socket gives an AMD guest an ApicIdCoreIdSize
of 15 without panicking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only the hypervisor's APIC suspends a VP that reads
HV_X64_MSR_GUEST_IDLE, which a save then records as the Hyper-V idle MP
state. The user-mode APIC, which `whp:user_mode_apic` selects, as does
`no_enlightenments` with `--hv`, never saves that state, but a snapshot
does not record which APIC captured it, so a restore with the user-mode
APIC can be given one, and restore_activity then reached
`unimplemented!()` and aborted the VMM.

The user-mode APIC cannot hold the state: an interrupt wakes an idle VP
even with its interrupts disabled, which a VP that it halts does not
take, so restoring the VP as halted would be wrong. restore_activity
now refuses the state before it changes anything, with the
UnsupportedState error that it returns for the other activity that WHP
cannot hold, as virt_kvm refuses the idle state with an error.

Test: the WHP case user_mode_apic_refuses_an_idle_vp_hv1, in the
suspend module of virt_backend_tests, restores an idle activity into the
VP of a partition with the user-mode APIC and Hv1, and requires that
the restore fails with UnsupportedState and leaves the activity as it
was. The activity differs from the VP's in the pending NMI, which the
user-mode APIC keeps, and in the NMI mask and the interrupt shadow,
which WHP's registers keep, so the case also fails when
restore_activity sets the pending NMI or writes the interrupt state
before it refuses the state. On Windows 11 build 26300 with an Intel
Core i9-12900H, at d44a113 the case panics at apic.rs:261 with "not
implemented", and with this commit it passes, as do the other 26 cases
of virt_backend_tests that run on WHP there and the 45 tests of
virt_whp. There, a snapshot's restore does not reach the activity: the
VP that the hypervisor's APIC saves holds a TSC deadline, which the
partition with the user-mode APIC does not support, so restore_all
refuses that element first. A saved state without one reaches the
activity. The Guide's page on the backend contract tests names the case.
cargo check, cargo clippy --all-targets, and cargo doc for virt_whp,
cargo clippy --all-targets for vmm_tests, and cargo xtask fmt have no
warnings.

Refs microsoft/nvx#1475

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A KVM partition with Hyper-V enlightenments routes the SynIC of each VP
through a GSI of its own, VMBUS_BASE_GSI, after the 24 lines of the I/O
APIC, plus the VP's index, which build claims in the partition's routing
table of NUM_GSIS, 2048, GSIs. Nothing checked the number of VPs against
that table, so build, on a host whose KVM allows that many vCPUs,
created every vCPU of a partition of more than 2024 enlightened VPs and
then panicked in GsiRouting::claim, "index out of bounds: the len is
2048 but the index is 2048", in debug and release builds alike
(microsoft/nvx#1377). Only the VM's configuration reaches it, before the
guest runs.

new_partition now refuses such a configuration before it creates the
VM, with the new KvmError::TooManyVps, which names the number of VPs and
the limit, MAX_SYNIC_VPS, NUM_GSIS less VMBUS_BASE_GSI, or 2024. A
partition without enlightenments, such as an NVX microVM, routes nothing
for its VPs, and is not limited. No saved state, format, or version
changes.

On nvx-kvm-test (Azure Linux 3, Linux 6.18.57, KVM built with
CONFIG_KVM_MAX_NR_VCPUS=4096), with RLIMIT_NOFILE raised to 8192, a
scratch /dev/kvm test of virt_kvm built partitions at d44a113: one of
2024 enlightened VPs built, one of 2025 enlightened VPs panicked as
above, and one of 2025 VPs without enlightenments built. With the fix,
new_partition refuses the second with "a partition with Hyper-V
enlightenments supports at most 2024 VPs, not 2025", and the others
build as before.

Tests: a KVM-only contract test of virt_backend_tests, which OpenVMM's
CI runs on its KVM hosts, creates partitions without building them, so
without creating their VPs, and requires that one of 2025 enlightened
VPs is refused with KvmError::TooManyVps, and that one of 2024
enlightened VPs, and one of 2025 VPs without enlightenments, are not.
It fails on nvx-kvm-test with the check disabled, and passes with it.
The Guide's section on the backend contract tests lists it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
An AP of an SEV-ES or SEV-SNP guest waits in its AP reset hold once the
guest asks for it through the GHCB, with the AP Reset Hold VMGEXIT or
the GHCB MSR protocol's request, and KVM_GET_MP_STATE then reports
KVM_MP_STATE_AP_RESET_HOLD (9). The activity of a VP panicked on any MP
state that it did not map, with "unrecognized mp state 9", although it
returns a Result, so a save of such a VP, and an inspection of its state
(vp/N/vtl0), which both read the activity, aborted the VM worker's
process, whose dev and release profiles abort on a panic
(microsoft/nvx#1383). Its arm for KVM_MP_STATE_SIPI_RECEIVED, which KVM
never reports, was a todo!().

The activity now maps the MP state with mp_state_from_kvm, which keeps
the four mappings and refuses every other state with the new
KvmError::UnsupportedMpState, which names the VP and the state. KVM
wakes an AP in its reset hold as it wakes a halted one, but keeps the
guest's request, which an INIT and a SIPI complete instead of starting
the AP at the SIPI's vector, so no MP state of the activity describes
the hold. A save of such a VP now fails, so a capture rolls back and
the guest continues, and an inspection shows the rest of the VP's state
without its activity. No saved element, format, or version changes,
and a partition without isolation, such as NVX's microVM, never holds
a vCPU in the hold.

Tests: a unit test maps each MP state that the activity describes, and
requires the refusal, with the VP and the state, of the reset hold, of
SIPI_RECEIVED, of an aarch64 state, and of an undefined one. A KVM
test, ignored for its need of /dev/kvm, binds the second VP of a
partition without isolation, puts it in the reset hold with
KVM_SET_MP_STATE, which KVM accepts for any vCPU with an in-kernel
LAPIC, and requires that its activity and its save fail with the error
and that it stays in the hold. On nvx-kvm-test, an Intel Xeon Platinum
8573C VM that runs Linux 6.18.57, the KVM test panicked at d44a113
with "unrecognized mp state 9", and passes with the fix, as do all 156
virt_kvm tests, the ignored ones included. cargo check, cargo clippy
--all-targets -- -D warnings, and cargo doc with -D warnings pass for
virt_kvm there, and cargo xtask fmt is clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On Intel, topology_cpuid reports in leaf 4 that the VPs of a socket
share its L3 cache: cache_parameters_cpuid encodes the topology's
reserved VPs per socket, less one, as the number of logical processors
sharing the cache, a 12-bit field (EAX[25:14]). The topology builder
accepts up to 32768 VPs per socket and reserves that count rounded up to
a power of two, so a socket of more than 4096 VPs overflowed the field,
and its bitfield setter panicked with "value out of bounds [0, 4095]" in
debug and release builds, whatever the VM's VP count
(microsoft/nvx#1379). That aborted the creation of a standard VM on an
Intel host with KVM, without a time ABI, or with WHP, which build the
topology CPUID from the host's, when --vps-per-socket asked for more
than 4096 VPs per socket, or when the host topology that the standard VM
starts from had that many, as that of a host whose leaf 0Bh core level
has an x2APIC shift above 12 does. The microVM, which refuses
--vps-per-socket, starts from its own topology, and has at most 8 VPs in
its one socket, never reached it, nor did a time ABI partition, which
only the microVM has.

The count now saturates at the field's maximum, 4096 logical processors,
as the core count of the same leaf and the sharing count of AMD's leaf
8000001Dh already do, so the guest of such a socket sees an L3 cache per
4096 APIC IDs. Counts of up to 4096 VPs per socket, and every other
field of the leaf, are unchanged, so no CPUID that OpenVMM produced
before changes, the time ABI's effective CPUID included.

Tests: l3_sharing_saturates_above_4096_vps_per_socket builds the
topology CPUID of a VM with one VP and 4096, 4097, or 32768 VPs per
socket, with and without SMT, from an Intel and an AMD CPUID, and finds
the L3 cache shared by 4096 logical processors and each L1 and L2 cache
by the threads of a core. At d44a113, it panics as above on Intel.
On Intel hosts, the standard VM with one VP and --vps-per-socket 8192
panicked so at d44a113 on KVM (Xeon Platinum 8573C) and WHP (Xeon
Platinum 8370C); with the fix applied there, it starts and runs its
guest on both with 8192 and 32768 VPs per socket, as it did with 4096.
virt's unit tests pass on Windows and Linux.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With the APIC that the VMM emulates, as `whp:user_mode_apic` gives it,
and as Hv1 without the hypervisor's enlightenments does, every restore
of a VP's activity failed, and so did every INIT to an AP.
restore_activity wrote the four registers of vp::Activity, the internal
activity state among them, and with LocalApicEmulationMode None WHP
denies a write of that register with HV_STATUS_ACCESS_DENIED, even of
the running state that it holds. So restore_all failed at "activity"
for every saved state, even the save of a new VP, and x86_init, which
makes an AP wait for a SIPI through set_activity, failed in inject_init,
which unwraps the error and aborts the VMM: every multiprocessor guest
sends its APs an INIT. hv1_emulator's set_x86_vp_context, which starts
a VP for HvCallStartVirtualProcessor, failed the same way.

In this mode the VMM keeps the VP's halt and its wait for a SIPI itself,
and the hypervisor's internal activity state stays running, which is
all that the restore wrote there. restore_activity now writes only the
other three activity registers, the pending interruption, the interrupt
state, and the pending event, which WHP accepts.

Test: the new `user_mode_apic` module of virt_backend_tests registers
four cases for `whp_user_mode_apic`, a WHP backend whose APIC the VMM
emulates. restores_the_activity_in_each_state restores an activity in
each state that the VMM keeps, with an NMI pending, NMIs masked, an
interrupt shadow, and a pending exception as both an interruption and
an event, and requires that it reads back as given, in the VP and, from
a save of it, in a new partition's VP. The interruption is an exception
because WHP refuses a pending interrupt with HV_STATUS_INVALID_VP_STATE
while RFLAGS.IF is clear, as it is in a new VP.
restores_a_new_vp_into_a_new_partition restores a save of a new VP into
a new partition, without Hv1 and with it.
an_init_makes_an_ap_wait_for_a_sipi sends the AP of a two-VP partition
an INIT and then a SIPI, twice, and flushes the AP's requests after
each, as the VMM does before it saves a VP, and requires that the INIT
makes the AP wait for a SIPI, at its reset RIP, and that the SIPI starts
it at the SIPI's vector. The fixture gains build_all, and with_vps for a
fixture of more than one VP, for it. The Guide describes the cases.

On Windows 11 build 26300 with an Intel Core i9-12900H, at d44a113,
the four cases fail: restores_the_activity_in_each_state with "failed to
set registers: Access to the specified object was denied. (os error
-1070268410)", both cases of restores_a_new_vp_into_a_new_partition with
the same error at phase restore "activity", and
an_init_makes_an_ap_wait_for_a_sipi with the panic at apic.rs:764 that
the issue reports. With this change on d44a113 they pass, as do the
other 26 cases of virt_backend_tests that run there (10 report ignored),
and the 64 tests of virt_whp, those that need WHP included. cargo clippy
--all-targets for virt_whp and vmm_tests, which also passes for
virt_backend_tests on x86_64-unknown-linux-gnu, cargo doc, and cargo
xtask fmt have no warnings.

Refs microsoft/nvx#1472

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On a heavily loaded Linux host, about one microVM start in eight
failed with "driver does not support io-uring" (microsoft/nvx#1909).
The epoll driver sets up its io-uring lazily, at its first probe or
submission, and dropped the error of that set-up with `.ok()`, so a
failed `io_uring_setup`, such as one that fails with ENOMEM, read as a
driver without io-uring support, and its errno was lost.

`IoUringDriver::io_uring_submitter` and `Driver::io_uring_probe` now
return the error that keeps a driver from providing an io-uring: the
error of the epoll driver's set-up, or an `Unsupported` error of a
driver without io-uring. A failed set-up still leaves the epoll driver
without a ring, so its next probe tries again. `disk_blockdevice` fails
a device with "failed to set up io-uring" and that error as its source,
and a submission through a driver that cannot set up its io-uring fails
with that error rather than `Unsupported`. `disk_vmdk` still falls back
to its portable reads when the probe fails.

With `io_uring_setup` refused with ENOMEM by a seccomp filter, the
fatal error of a `nvx sandbox run` on a Linux/KVM host ended with

    3: failed to create new device
    4: driver does not support io-uring

and now ends with

    3: failed to create new device
    4: failed to set up io-uring
    5: Cannot allocate memory (os error 12)

Tests: the epoll driver reports the ENOMEM of a refused
`io_uring_setup` and sets its ring up at the next probe, and a block
device over a driver whose `io_uring_setup` fails names the set-up and
its errno.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A microVM directory listing that already holds 4,096 entries, `.` and
`..` included, failed with E2BIG when the host listed another entry
that the access policy hides, although the guest never sees that entry
(microsoft/nvx#2093). The same directory listed all 4,096 entries when
the host listed the hidden entries first, so whether the first
FUSE_READDIR or FUSE_READDIRPLUS of a handle failed depended on the
host's enumeration order, which the guest cannot control.

build_microvm_directory_snapshot checked the 4,096-entry bound at the
top of its read_dir callback, before the name check and the policy
filter, so a hidden entry counted toward the bound as if it were
listed. The check now runs where an entry is about to join the
listing, after the filter, beside the check of the 64 KiB bound on
names, which already ran there. Only the entries that the guest can
list count toward either bound, and a 4,097th of them still fails the
listing with E2BIG.

A test at the real bound needs a directory of more than 4,096 entries,
which takes seconds to create on Windows, past the 1 s after which
OpenVMM's CI profile calls a test slow and close to the 10 s after
which it ends one. build_microvm_directory_snapshot therefore lists
through build_microvm_directory_snapshot_within, which takes the bound
as a parameter, so that a test can pass a smaller one.

microvm_listings_count_only_the_entries_that_the_policy_shows hides
each of three files in turn, so that one of them is the last that the
host lists, and expects a bound of four entries to hold `.`, `..`, and
the two shown files, and a bound of three to fail with E2BIG. With the
check back at the top of the callback, it fails with E2BIG for the
file that the host lists last: `c` on NTFS, which lists names in
order, and `a` on the tmpfs of the Linux host, which lists the newest
first.

At feature/microvm/dev d44a113, a one-off test, not committed, that
fills a handle's listing with 4,094 shown files and hides one more file
fails the first FUSE_READDIR and FUSE_READDIRPLUS of the root with
E2BIG when the hidden file is the last that the host lists, and lists
all 4,096 entries when it is the first, on Windows 11 Enterprise (build
26300, NTFS) and on Azure Linux 3 (kernel 6.18, tmpfs). With the fix,
it lists all 4,096 entries in both cases on both hosts, and a listing
of 4,095 shown files still fails with E2BIG; the other tests of the
virtiofs package pass there too.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added Guide release-nvx Targets a branch under feature/microvm/. unsafe Related to unsafe code labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Pedro Henrique Penna (ppenna) added a commit to microsoft/nvx that referenced this pull request Nov 25, 2026
…the OpenVMM roadmap

Map position 385, the commit of microsoft/openvmm#5279, which NVX now
pins at 043083f40, 259 commits past the mapped tip, on 44747bf1c,
position 384, the head of microsoft/openvmm#5278:

- 385, virtiofs: count only shown entries toward a microVM listing's
  bound. The listing that the first read of a microVM directory handle
  takes checks its bound of 4,096 entries after the access-policy
  filter, beside its bound of 64 KiB of names, so that an entry that
  the policy hides no longer fails with E2BIG a listing whose shown
  entries fill the bound (#2093). Its test lowers the bound through
  the new build_microvm_directory_snapshot_within.

Position 385 is not yet assigned to a PR. It fixes a defect of PR18's
position 083, whose build_microvm_directory_snapshot checked the bound
before the filter that skips the entries that PR22's position 102's
denied paths and position 160's traverse-only directories hide, but
its code follows position 371's loop and its test needs PR22's
position 102 and positions 164 and 335, so it is not a PR18 fixup.
Positions 160, 330, 346, 349, 354, 355, and 371 also change the
microVM's file.rs, and none of positions 372-384 changes its files.
Upstream main, 8d4e03132, lacks the defect, since it lacks the
microVM's listings, and replaying the commit there conflicts in the
microVM's file.rs and fs_tests.rs, which upstream main lacks, so it
cannot go upstream on its own. The Scope also names the head of
feature/microvm/dev, fa239c823, since microsoft/openvmm#5275,
microsoft/openvmm#5276, and microsoft/openvmm#5277 landed positions
381-383.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ppenna
Pedro Henrique Penna (ppenna) merged commit 043083f into feature/microvm/dev Nov 25, 2026
134 of 139 checks passed
syeedali pushed a commit to syeedali/nvx that referenced this pull request Nov 25, 2026
A microVM's virtio-fs listing of a host directory whose shown entries,
`.` and `..` included, filled a handle's 4,096 entries failed the
guest's first FUSE_READDIR or FUSE_READDIRPLUS of the handle with E2BIG
when the host listed an entry that the share's access policy hides
after them, and listed them all when the host listed it first, so the
outcome depended on the host's enumeration order, which the guest
cannot control (microsoft#2093). A guest's busybox `ls -a` of such a share
printed nothing. The listing checked its bound of 4,096 entries before
the policy filter, so a hidden entry counted toward it.

Pin microsoft/openvmm 043083f4059c7dfda9d021a8cf983ac65017c91e, the head
of microsoft/openvmm#5279, one commit on 44747bf1c, the head of
microsoft/openvmm#5278, which NVX pins below this commit:

- virtiofs: count only shown entries toward a microVM listing's bound.
  The check of the 4,096 entries per handle runs after the policy
  filter, beside the check of 64 KiB of names, so only the entries
  that the guest can list count toward either bound, and a 4,097th of
  them still fails the listing with E2BIG. Its test fails without the
  fix, for the file that the host lists last, and passes with it, on
  Windows and Linux. The virtiofs package's tests pass at the pin on
  Windows, and on Linux at 5066e2c84, the same commit on d44a113be
  before its rebase onto microsoft/openvmm#5278 and the commits below
  it, which touch none of its files.

In an Alpine guest of release v0.1.0-dev.86984fe72c05, whose OpenVMM
CI built from d44a113be, `ls -a` of a read-only share of 4,095 files
whose policy hides the last file that the host lists printed no name,
on KVM (nvx-kvm-test, ext4) and on WHP (Windows 11, NTFS). With
OpenVMM built from the fix, 5066e2c84 on KVM and the pinned 043083f40
on WHP, it printed all 4,096 names, and the filesystem-shares,
filesystem-snapshot, filesystem-policy, filesystem-owner,
denied-filesystem-paths, filesystem-comma-paths, platform-filesystem,
and platform-aggregate-export scenarios passed 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>
@ppenna
Pedro Henrique Penna (ppenna) deleted the copilot/nvx-issue-2093-virtiofs-hidden-entries branch November 25, 2026 06:15
Pedro Henrique Penna (ppenna) added a commit to microsoft/nvx that referenced this pull request Nov 25, 2026
…M roadmap

Map position 389, the commit of microsoft/openvmm#5281, which NVX now
pins at 350018ce4, 263 commits past the mapped tip, on 1633b3797,
position 388, the head of feature/microvm/dev since
microsoft/openvmm#5280 landed positions 386-388:

- 389, virtiofs: let a new microVM object take the last node ID. The
  insert of the node of an object that FUSE_MKDIR, FUSE_MKNOD,
  FUSE_SYMLINK, or FUSE_CREATE makes, with the node ID that the request
  reserved before it made the object, no longer requires that the
  table can hand out another node ID, so that the object takes the
  last node ID, u64::MAX - 1, rather than stay on the host without a
  node after the request fails with ENOSPC (#2135). The inode and
  alias limits still apply to that insert.

Position 389 is a PR18 fixup. It fixes a defect of PR18's position
081, whose InodeReservation::insert check required another free node
ID, which position 083's restore makes reachable and position 350
moved to u64::MAX - 1, and it needs nothing that a later position adds
but, for its test, position 350's table and position 164's helpers.
Fold it into position 081, where its changes of lib.rs and limits.rs
apply as they are, as git merge-tree shows, and its test into position
350, where only the imports conflict: at 301937559, position 350, with
the fix and the test so placed, the virtiofs tests pass on Windows,
and without the fix the test fails. The Scope, the DAG, the fold
sentences, the PR summary, the dependency graph, and the commit
mapping record the fixup. Of positions 372-388, only 385 changes one
of its files, fs_tests.rs. Upstream main, 8d4e03132, lacks the defect,
since it lacks the microVM's limits, and replaying the commit there
conflicts in lib.rs and in the microVM's limits.rs and fs_tests.rs, so
it follows PR18 upstream. The Scope also records that
microsoft/openvmm#5277, microsoft/openvmm#5278, microsoft/openvmm#5279,
and microsoft/openvmm#5280 have landed positions 383-388 on
feature/microvm/dev.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Aaqibhafeez Khan (Aaqibhafeezkhan) pushed a commit to Aaqib-OSS/nvx that referenced this pull request Nov 25, 2026
OpenVMM's gdb stub never told the partition that the debugger had gone
(microsoft#2094). After GDB detached, its connection dropped, or the debug
worker stopped, the partition went on treating the debugger as
attached: the session's hardware breakpoints and single-stepping stayed
set on the VPs, the halts that followed, a power-off, reset, or triple
fault included, went to the gone debugger instead of the VM's client,
and a paused VM that a debugger's break held stayed held until a new
session or a clear-halt. nvx never starts the gdb stub, so only a host
debugging session reaches this.

Pin 1633b3797af878bc9a7c42e4b9c57a2925799d5d, the head of
microsoft/openvmm#5280, three commits on 043083f40, the head of
microsoft/openvmm#5279, which NVX pins below this commit:

- vmm_core: forget a debugger's halt reports when it detaches. A
  detach clears the partition's record that it told the debugger of
  the recorded halt, which the next session's first resume took for
  the debugger continuing from a halt recorded after the detach, such
  as a power-off, and so ran the VM again. It reports the recorded
  halt to the client only when the halt went to the debugger instead,
  no longer a second time when the client heard of it before the
  debugger attached.
- vmm_core: clear VP debug state on detach only if the debugger set
  it, since the ARM64 backends of KVM and OpenHCL, which implement no
  guest debugging, panic when asked to clear it, which aborts the VMM.
- debug_worker: detach the debugger when its session ends. The stub
  attaches through a guard that sends DebugRequest::Detach when it is
  dropped, however the session ends: GDB's D or k packet, a target
  exit, an error such as a dropped connection, or the worker dropping
  the session as it stops or restarts. The guard also forgets the
  session's hardware breakpoints, which the next session's first
  resume set on the VPs again. The Guide's gdbstub page says what a
  detach does.

No saved state, protocol, ABI, or format, and no version of any of
them, changes. NVX needs no coordinated change: the protocol vectors,
the source excerpts, the contract versions, the activation bound, and
the CPU profiles that nvx copies from OpenVMM match the revision's.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Aaqibhafeez Khan (Aaqibhafeezkhan) pushed a commit to Aaqib-OSS/nvx that referenced this pull request Nov 25, 2026
…enVMM roadmap

Map positions 386-388, the commits of microsoft/openvmm#5280, which
NVX now pins at 1633b3797, 262 commits past the mapped tip, on
043083f40, the head of microsoft/openvmm#5279, whose position 385
follows position 384, 44747bf1c, the head of microsoft/openvmm#5278,
whose position follows position 383, fa239c823, the head of
feature/microvm/dev since microsoft/openvmm#5277 landed it:

- 386, vmm_core: forget a debugger's halt reports when it detaches. A
  detach clears halt_reported, which the next session's first resume
  took for the debugger continuing from a halt recorded after the
  detach, and reports the recorded halt to the client only when the
  halt went to the debugger instead, which position 150's record_halt
  now records through DebuggerState::route_halt.
- 387, vmm_core: clear VP debug state on detach only if the debugger
  set it, since the ARM64 backends of KVM and OpenHCL panic on any
  request to set it.
- 388, debug_worker: detach the debugger when its session ends. The
  stub attaches through a guard that sends DebugRequest::Detach when
  it is dropped, however the session ends, and forgets the session's
  hardware breakpoints; the Guide's gdbstub page says what a detach
  does.

They are not fixups and stay unassigned to a PR: the missing detach
and the defects of its handling are upstream's, and positions 150 and
372, whose record_halt line and debugger tests they change or extend,
are not assigned to PRs. In partition_unit/debug.rs, they change
upstream's handling of Detach and SetDebugState, beside position 372's
hold, not the halt reasons that position 054 maps. No chain commit
changes the debug worker, and none of the 43 that change Cargo.lock
changes the entry of debug_worker. Of positions 373-385, only 378 and
384 change one of their files, other packages' entries of Cargo.lock.
Replaying them on upstream main, 8d4e03132, conflicts in
partition_unit.rs, partition_unit/debug.rs, and debug_rpc.rs, which
lack the code of positions 150 and 372, so they cannot go upstream on
their own.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Guide release-nvx Targets a branch under feature/microvm/. unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant