Repository navigation
openvmm: pin the IOAPIC's zero-extended wide reads - #1570
Merged
Pedro Henrique Penna (ppenna) merged 2 commits intoNov 13, 2026
Merged
Conversation
A guest read of the emulated IOAPIC's index or data register wider than 4 bytes, such as a 64-bit mov from 0xfec00000, panicked OpenVMM's VP thread with "copy_from_slice: source slice length (4) does not match destination slice length (8)" in IoApicDevice::mmio_read, which ended the VM (#1140). Pin e2458a6cef958c3ac2d710e13a6ba490a9911b88, the head of microsoft/openvmm#5084, one commit on 09cd771c0, the head of feature/microvm/dev: - e2458a6ce chipset: zero-extend wide IOAPIC MMIO reads mmio_read copied the 32-bit register's min(len, 4) low bytes into the whole buffer, so only reads of at most 4 bytes matched the slice lengths. It now copies those bytes into the start of the buffer and zeroes the rest, so a wider read returns the register zero-extended, as the CMOS RTC does for a wide read of its ports, and a narrower one still returns the register's low bytes. Evidence: with OpenVMM built from 09cd771c0, the previous pin, an Alpine guest on 1 processor that maps /dev/mem at 0xfec00000 and reads the index and data registers with 32-bit and then 64-bit loads panicked OpenVMM at vm/devices/chipset/src/ioapic/mod.rs:724:14 on its first 64-bit load, on nvx-kvm-test, nvx-mshv-test, and nvx-whp-test. At the pin, its 64-bit loads read the values of its 32-bit loads, zero-extended, on all three hosts, on 1 and 2 processors. Tests: with OpenVMM built from the pin, the microVM scenarios smp, on 1 and 2 processors, and interrupt-map pass on nvx-kvm-test, nvx-mshv-test, and nvx-whp-test. The revision's new chipset test, mmio_reads_of_any_size_are_zero_extended, fails at 09cd771c0 with the panic above, and its 132 chipset tests pass on Windows and on Linux, on nvx-kvm-test. NVX needs no coordinated change: the control-session vectors, the source excerpts, the contract versions, the activation bound, and the CPU profiles that nvx-rs copies from OpenVMM match the revision's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The NVX pin moves to e2458a6ce, position 274, 150 commits past the mapped tip. Position 274, the one commit of microsoft/openvmm#5084 on 09cd771c0, the head of feature/microvm/dev, is not yet assigned to a PR. Position 274 makes the IOAPIC's mmio_read zero-extend a read of its index or data register wider than 4 bytes, which panicked the vCPU thread, and so OpenVMM, because it copied the register's low bytes into the whole buffer. The code is upstream main's, and the commit adds a test to the device's tests, in a file whose saved-state tests position 183 also changes; it changes none of position 183's code and nothing that a mapped PR adds. Replaying it on upstream main, 7d90c4104, applies without conflicts, and chipset type-checks there with its tests, which pass, so it can go upstream on its own. 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 roadmap pin and bookkeeping update.
No open issues 🎉
What changed in this PR
This PR pins the OpenVMM fix for #1140, preventing wide IOAPIC register reads from panicking the VM by zero-extending the 32-bit value.
Changes:
- Updates the roadmap’s pinned revision to
e2458a6ceat position 274. - Adjusts chain counts and records the new commit as unassigned to an upstream PR.
- Documents the fix’s scope and its ability to go upstream independently.
| File | Description |
|---|---|
doc/openvmm-upstream-roadmap.md |
Records the new pin, updates chain bookkeeping, and explains the IOAPIC fix’s upstream applicability. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-1140-ioapic-wide-read
branch
November 13, 2026 23:24
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 #1140
What and why
This pins microsoft/openvmm#5084 at
e2458a6cef958c3ac2d710e13a6ba490a9911b88. With the pin, a guest read of the emulated IOAPIC's index or data register that is wider than 4 bytes, such as a 64-bitmovfrom0xfec00000, returns the 32-bit register zero-extended. Before, such a read panicked OpenVMM's vCPU thread and ended the VM.At NVX's previous pin,
09cd771c0:IoApicDevice::mmio_readcomputedn = data.len().min(4)and then calleddata.copy_from_slice(&v.to_ne_bytes()[..n]), which requires both slices to have the same length. Reads of 1 to 4 bytes worked. A 5- to 8-byte read panicked with "copy_from_slice: source slice length (4) does not match destination slice length (8)" atvm/devices/chipset/src/ioapic/mod.rs:724:14.IoApicDeviceon KVM, MSHV, and WHP alike. Any guest that can issue the access, such as a process with/dev/memor a kernel driver, could end its own VM.What the OpenVMM pull request changes
microsoft/openvmm#5084 adds one signed commit on
09cd771c0, the head offeature/microvm/dev. It has a good signature (openvmm_pin.py source).e2458a6cemmio_readcopies the register'snlow bytes intodata[..n]and zeroesdata[n..]. A wider read returns the 32-bit register zero-extended, asRtc::io_readdoes for a wide read of its ports since microsoft/openvmm#5072, and a narrower one still returns the register's low bytes. A read of another offset still fails withInvalidRegisterand leaves the buffer as it was. The testmmio_reads_of_any_size_are_zero_extendedsets the IOAPIC's ID and redirection entry 5, then reads the index register and the data register (with the ID, the version, and both halves of entry 5 selected) at every length from 1 to 8 bytes, into a buffer of0xa5bytes, and requires the register's low bytes followed by zeros.The patch that Ruize Tang (@tangruize) attached to #1140 makes the same change.
Pin details
mod tests, in a file whose saved-state tests (save_restore::tests) position 183 also changes. It changes none of position 183's code and nothing that a mapped PR adds.7d90c4104, applies without conflicts (merged tree49dce963c). There,cargo check -p chipsetpasses, andcargo nextest run -p chipsetpasses all 69 tests, including the new one, so the commit can go upstream on its own.09cd771c0, is NVX's previous pin and the head offeature/microvm/dev.nvx-rscopies from OpenVMM all match the revision's.Scope and limits
InvalidAccessSize.Landing order
microsoft/openvmm#5084 lands first, by fast-forwarding
feature/microvm/devfrom09cd771c0toe2458a6ce(python3 scripts/openvmm_pin.py land e2458a6cef958c3ac2d710e13a6ba490a9911b88 --remote origin --push). This pull request merges after that. OpenVMM's merge button would squash the commit and leave the pinned revision off the branch, so don't use it.Validation
NVX
Run on Windows:
python scripts\openvmm_pin.py source e2458a6cef958c3ac2d710e13a6ba490a9911b88 --pr 5084: passed. The revision is the pull request's head, with a good signature.python scripts\openvmm_pin.py check-roadmap: passed, with 274 positions and 285 references.python scripts\openvmm_pin.py check-branch --target origin/devandcheck-branch --topic: passed, with two signed commits and no coordinated files.python scripts\check_markdown_links.pyandgit diff --check: passed.python scripts\nvx.py verify: passed.python scripts\local_gates.py --base origin/dev --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles nvx-cli --run --keep-going, withNVX_RSset to a releasenvx-rs:scripts\test_adversarial.py -v(84 tests OK, 11 skipped) and the eightnvx.py … --helpcommands, then passed when run on their own.IssueWorkspaceTests.test_find_groups_exact_issue_matches_from_every_source, is a flaky test, unrelated to this change. The test's temporary repository gets commits with fresh timestamps, so their SHAs are random.findnames a commit candidate by its 12-digit abbreviated SHA and subject. The test asserts that no candidate's name contains570, which such a prefix does about once in 200 runs. It failed 3 times in about 490 runs: once in the gate, once in 8 standalone runs, and twice in loops. The last loop captured the offending candidate,commits on origin/dev | 0534a5706fbf Fix #57 on dev. This branch changes no scripts.OpenVMM
For
chipset, with this change, with Rust 1.97.1 and cargo-nextest 0.9.133:cargo check,cargo clippy --all-targets,cargo doc --no-deps, andcargo nextest run --profile agent(132 passed) passed, andcargo xtask fmt --fixchanged nothing.cargo check,cargo clippy --all-targets,cargo doc --no-deps, andcargo nextest run --profile agent(132 passed) passed.09cd771c0,mmio_reads_of_any_size_are_zero_extendedfails at its first 5-byte read with the panic above, atmod.rs:724:14.Hosts
The checkouts were at #1569's head,
f02bdcd53. On each host,nvx-rs downloadinstalledv0.1.0-dev.131aa44c4207, the nearest first-parent ancestor with a release. Thennvx.py build-openvmmbuilt OpenVMM from the pinned revision. With the gitlink staged ate2458a6ce, the hosts' index tree wasd1062d7d0, the tree of this branch's pin commit.record-openvmm-provenancereportssource_revisione2458a6ceand a clean source.A static guest program in the Alpine microVM mapped
/dev/memat0xfec00000. It read the index (+0x00) and data (+0x10) registers with 32-bit loads, then with 64-bit loads. It got0x34and0x21with 1 processor and0x34and0x20with 2.nvx.py test-microvm --backend BACKEND --scenario interrupt-map --scenario smp --processors 1 2ransmpwith 1 and 2 processors andinterrupt-maponce.09cd771c0, 1 processore2458a6ce(SHA-256), 1 and 2 processorse2458a6cemod.rs:724:147a9db54a…: 64-bit reads zero-extendedmod.rs:724:14ca02013e…: 64-bit reads zero-extendedmod.rs:724:1441c642c6…: 64-bit reads zero-extendedCI
799ad739c, passed: the microVM matrix on KVM, MSHV, and WHP, NVX CLI on Linux and Windows, the performance gate,OpenVMM CI of the pinned revision, andRequired status check.e2458a6ce: run 43511358061. The six jobs that NVX requires passed:unit tests [x64-linux]and[x64-windows], andrun vmm-testsforx64-linux-amd-kvm,x64-linux-intel-mshv,x64-windows-intel, andx64-windows-amd. Two jobs that NVX doesn't require failed in the first attempt:run vmm-tests [x64-windows-intel-tdx]failed one test of 119.memstat::…_memory_validation_debug_very_heavy, a Windows OpenHCL guest's memory test, timed out after 770 s. This change can't affect it: reads of up to 4 bytes behave as before, and wider ones panicked before. TDX passed at the base, so this was a transient timeout. Its one rerun passed, and so didopenvmm checkin gates.run vmm-tests [x64-windows-amd-snp]fails at the base too (run 43489085265). 19 of 86 tests failed there and 16 here, 11 of them in both runs, mostly with "VM did not start after reset in the required time". Neither run logs an IOAPIC warning or error. It wasn't rerun.