From: Jan Beulich Date: Thu, 26 Jul 2012 15:51:51 +0000 (+0100) Subject: x86/hvm: don't leave emulator in inconsistent state X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8121 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=09dc3b63b3edd989e7de6f7aaa2fa24f6996aab2;p=xen.git x86/hvm: don't leave emulator in inconsistent state The fact that handle_mmio(), and thus the instruction emulator, is being run through twice for emulations that require involvement of the device model, allows for the second run to see a different guest state than the first one. Since only the MMIO-specific emulation routines update the vCPU's io_state, if they get invoked on the second pass, internal state (and particularly this variable) can be left in a state making successful emulation of a subsequent MMIO operation impossible. Consequently, whenever the emulator invocation returns without requesting a retry of the guest instruction, reset io_state. Signed-off-by: Jan Beulich Acked-by: Keir Fraser Committed-by: Ian Jackson --- diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 31af045fd9..c20f4e898b 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -179,6 +179,8 @@ int handle_mmio(void) rc = hvm_emulate_one(&ctxt); + if ( rc != X86EMUL_RETRY ) + vio->io_state = HVMIO_none; if ( vio->io_state == HVMIO_awaiting_completion ) vio->io_state = HVMIO_handle_mmio_awaiting_completion; else