i8259-dm.c - close timing window
PATCH 1/1 i8259-dm.c - close timing window
A window's a window no matter how small... right ?
When signaling an edge-triggered interrupt to the hypervisor via the shared page, be sure to set the IRR bit *after* setting the LAST_IRR bit. Otherwise the hypervisor can notice the set bit and the guest may handle the interrupt before QEMU sets the LAST_IRR bit -- which will then mask the NEXT occurrence of that irq. And, as much as I would like to say that this was fixed for theoretical reasons, it was fixed because it happened (repeatedly) and hurt.
Signature · 5 lines
------------------------------------------------------------------------ Ben Thomas Virtual Iron Software [email protected] Tower 1, Floor 2 978-849-1214 900 Chelmsford Street Lowell, MA 01851
When signaling an edge-triggered interrupt to the hypervisor via the shared page, be sure to set the IRR bit *after* setting the LAST_IRR bit. Otherwise the hypervisor can notice the set bit and the guest may handle the interrupt before QEMU sets the LAST_IRR bit -- which will then mask the NEXT occurrence of that irq.
tools/ioemu/target-i386-dm/i8259-dm.c +2 -1
@@ -65,8 +65,9 @@ void pic_set_irq_new(void *opaque, int i/* edge */ if ( level ) {if ( (mask & gio->pic_last_irr) ==0 ) { +/* Set pic_irr last to avoid racing guest intr handling! */ +atomic_set_bit (irq, &gio->pic_last_irr);atomic_set_bit (irq, &gio->pic_irr); -atomic_set_bit (irq, &gio->pic_last_irr); cpu_single_env->send_event =1 ; } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel