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
openvmm: a secondary PIC poll leaves a stale cascade request and the next INTA can panic #1139
A guest polling the secondary 8259 PIC can leave the primary's cascade request asserted after the secondary interrupt has been acknowledged. The next interrupt acknowledgement can panic the VM worker with pic1 ready was set.
In vm/devices/chipset/src/pic/mod.rs, DualPic::io_read calls the state-changing read_command but returns without synchronizing outputs:
In poll mode, read_command acknowledges the polled controller's interrupt. Its request falls, but the primary IRQ2 cascade input and CPU-ready output retain their previous values. DualPic::acknowledge_interrupt consequently acknowledges the primary cascade and reaches the secondary with nothing pending.
Reproduction
Initialize the dual PIC, unmask IRQ8 and the primary cascade, and enable ExtINT delivery. Assert IRQ8, write poll OCW3 0x0c to secondary command port 0xa0, then read one byte from 0xa0. The read returns 0x80, acknowledging secondary IRQ0.
The ready output remains asserted. Taking the subsequent interrupt acknowledgement reaches the secondary's no-pending-interrupt assertion instead of returning no interrupt.
Fix
fix.patch calls sync_outputs after either command-port read, matching the existing write behavior. Poll acknowledgements immediately update the cascade and ready lines; ordinary command reads are unchanged, and data/ELCR reads do not require synchronization.
Patch against OpenVMM 998b9f2402050cd16d1faa897bc831ef1434be48. Save the contents below as fix.patch and run git apply fix.patch.
fix.patch
diff --git a/vm/devices/chipset/src/pic/mod.rs b/vm/devices/chipset/src/pic/mod.rs
index 1babcc9ce..06350f7b3 100644
--- a/vm/devices/chipset/src/pic/mod.rs+++ b/vm/devices/chipset/src/pic/mod.rs@@ -176,6 +176,14 @@ 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 command-port read in poll mode acknowledges an interrupt: resync the+ // outputs, as after every write.+ if matches!(+ io_port,+ PRIMARY_PIC_COMMAND_PORT | SECONDARY_PIC_COMMAND_PORT+ ) {+ self.sync_outputs();+ }
IoResult::Ok
}
@@ -963,4 +971,22 @@ fn test_non_specific_eois() {
assert_eq!(pic.pics[0].isr, 0b101000);
}
++ /// Regression test of BUG-04 (finding PIC-2): a poll-mode read of the secondary's+ /// command port acknowledges its interrupt; the outputs are then resynced, so the+ /// cascade line falls, the `ready` line falls, and a CPU acknowledgement finds nothing+ /// pending instead of panicking ("pic1 ready was set").+ #[test]+ fn secondary_poll_then_acknowledge_does_not_panic() {+ let (ready, mut pic) = create_pic();+ pic.set_irq(8, true);+ assert!(ready());+ pic.io_write(SECONDARY_PIC_COMMAND_PORT, &[0x0c]).unwrap();+ let mut data = [0];+ pic.io_read(SECONDARY_PIC_COMMAND_PORT, &mut data).unwrap();+ assert_eq!(data[0], 0x80);+ assert!(!ready());+ assert_eq!(pic.pics[0].lines & (1 << PIC_CHAIN_COMMUNICATION_IRQ), 0);+ assert_eq!(pic.acknowledge_interrupt(), None);+ }
}
Closing: this is an OpenVMM bug outside NVX, the one that #1062 also reports, 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
tangruize commentedon Nov 1, 2026
Proposed patch
Patch against OpenVMM
998b9f2402050cd16d1faa897bc831ef1434be48. Save the contents below asfix.patchand rungit apply fix.patch.fix.patchppenna commentedon Nov 11, 2026
Closing: this is an OpenVMM bug outside NVX, the one that #1062 also reports, 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.