Repository navigation
virt_support_apic: ignore DFR writes with a reserved model - #5247
Sunil Muthuswamy (sunilmut) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the reserved-DFR handling changes.
No open issues 🎉
What changed in this PR
This PR hardens the software APIC against reserved DFR model values, preventing guest writes or malformed saved state from panicking OpenVMM or OpenHCL.
Changes:
- Ignores reserved-model DFR writes, preserving the current mode and logging a rate-limited warning.
- Falls back to flat mode when restoring a reserved DFR model.
- Adds regression coverage for full-register and high-byte writes in both modes, plus restore fallback.
| File | Description |
|---|---|
vmm_core/virt_support_apic/src/lib.rs |
Handles reserved DFR models without panicking and adds regression tests. |
Review effort: Balanced
… roadmap Map position 369, the commit of microsoft/openvmm#5260, which NVX now pins at 8c1204c68, 243 commits past the mapped tip: - 369, virt_support_apic: select a reserved DFR model by bit 31. cluster_mode selects the flat model for a reserved model of the xAPIC DFR whose bit 31 is set and the cluster model for one whose bit 31 is clear, as in Hyper-V's APIC, rather than reach unreachable!, for a guest's write and a restore alike, which aborted the VMM of WHP's user-mode APIC and of OpenHCL's SNP and TDX backends. Position 369 is not yet assigned to a PR. It changes lib.rs of virt_support_apic, where PR10's position 026 makes TIMER_FREQUENCY public, none of the lines that it changes. It is not a fixup: the unreachable! is upstream's. It applies to upstream main, efe0b08df, as it is, and virt_support_apic type-checks and passes its tests on the merged tree, so it can go upstream on its own. microsoft/openvmm#5247 proposes another fix of the same panic upstream, which ignores such a write; replaying the commit on it conflicts in lib.rs, which the remarks record for the next rebase. The Scope now names 9805f8984, position 368, as the head of feature/microvm/dev, since microsoft/openvmm#5254, microsoft/openvmm#5255, and microsoft/openvmm#5257 landed positions 362-368 there. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A guest DFR write with a model other than flat or cluster hit unreachable!, letting a VTL0 guest panic OpenHCL (or OpenVMM on WHP) with a single xAPIC MMIO write. Ignore such writes with a rate-limited warning, and restore a saved DFR with a reserved model as flat.
a61c5f4 to
041e195
Compare
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive VTL0 input handling requires human review of reserved-DFR and malformed-state restore policies, especially given the source-only review without backend runtime validation.
No open issues 🎉
Review effort: Balanced
|
Hi John Starks (@jstarks), thanks for your earlier approval. We have now rebased this PR onto main. Could you please take another look at the rebased changes when you have a chance? Thanks! |
cluster_mode()accepted only the flat (0xF) and cluster (0x0) DFR modelvalues and hit
unreachable!for the other 14. The DFR value comes straightfrom a guest xAPIC MMIO write, so a VTL0 guest could panic OpenHCL on SNP/TDX,
or OpenVMM using the WHP software APIC, with one write to
0xFEE000E0(or aone-byte write to
0xFEE000E3). Restoring a saved state with such a DFRpanicked the same way.
The SDM reserves those model values. This change:
warning, so the APIC keeps its current mode.
rate-limited warning.
save()never produces such a value, so this onlyaffects malformed saved state, and it avoids failing the whole restore over
one register.
Adds
dfr_with_reserved_model_is_ignored, which covers reserved writes in flatand cluster mode (full and high-byte writes) and the restore fallback. It fails
without the fix.