You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chipset: PIC poll-mode read does not re-sync outputs; the next INTA panics with "pic1 ready was set" #1062
A poll-mode read of a PIC command port (OCW3 with P = 1) acknowledges the highest-priority pending IRQ, but DualPic::io_read never calls sync_outputs() afterwards. io_write, set_irq, acknowledge_interrupt and reset all do. As a result, the cascade line (primary IRQ2) and ready keep stale levels. After a poll of the secondary, the next INTA cascades into a secondary with nothing pending and panics. A guest can trigger this with two port accesses.
Add the attached pic_poll_read_sync.rs (.txt) to vm/devices/chipset/tests/ and run:
cargo test -p chipset --test pic_poll_read_sync
Initialize both PICs (ICW1–ICW4).
set_irq(8, true): IRQ8 is pending and ready goes high.
Write 0x0c (OCW3, poll) to port 0xa0, then read 0xa0. It returns 0x80: the secondary acknowledged IR0.
acknowledge_interrupt(), since ready is still high.
Expected
After step 3 nothing is pending, so IRQ2 and ready go low. On an 8259A, a cascaded slave with no request answers INTA with its IR7 (spurious) vector.
Actual
thread 'secondary_poll_then_inta_does_not_panic' panicked at vm/devices/chipset/src/pic/mod.rs:113:17:
pic1 ready was set
poll_read_resyncs_outputs also fails: ready is still high after the poll acknowledged the only pending IRQ.
Root cause
sync_outputs() derives primary IRQ2 from the secondary's state and ready from the primary's state. io_read (pic/mod.rs:166) skips it, which breaks the invariant behind assert!(requested, "pic1 ready was set"): IRQ2 high ⇒ the secondary has a request. A poll of the primary leaves ready high in the same way, and the next INTA then returns a spurious interrupt.
Impact
A guest can panic the VMM with two PIO accesses while any IRQ 8–15 (e.g. the RTC) is pending. Poll mode is rare in modern OSes.
Suggested fix
--- a/vm/devices/chipset/src/pic/mod.rs+++ b/vm/devices/chipset/src/pic/mod.rs@@ -176,6 +176,9 @@ fn io_read(&mut self, io_port: u16, data: &mut [u8]) -> IoResult {
SECONDARY_PIC_ELCR_PORT => self.pics[1].elcr,
_ => return IoResult::Err(IoError::InvalidRegister),
};
+ // A poll-mode command read acknowledges an interrupt, so the cascade+ // line and the ready output may need to change.+ self.sync_outputs();
IoResult::Ok
}
Closing: this is an OpenVMM bug outside NVX, and upstream fixed it in microsoft/openvmm#4838, chipset: synchronize PIC outputs after poll reads, merged on 2026-11-01. NVX's OpenVMM pin, 58d3c3b1d, includes it.
Activity
ppenna commentedon Nov 11, 2026
Closing: this is an OpenVMM bug outside NVX, and upstream fixed it in microsoft/openvmm#4838,
chipset: synchronize PIC outputs after poll reads, merged on 2026-11-01. NVX's OpenVMM pin,58d3c3b1d, includes it.