]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: handle IO when emulation is due to #GP in real mode.
authorGleb Natapov <gleb@redhat.com>
Thu, 20 Dec 2012 14:57:47 +0000 (16:57 +0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 2 Jan 2013 21:36:31 +0000 (19:36 -0200)
commitb376be7070b44be690fb9103b9e815b4c98c920c
treeedd7943dc03ffec9ed3055a499b9b98a1e4996bd
parent08745766da2f64a83a03752db99faa046bef79e4
KVM: VMX: handle IO when emulation is due to #GP in real mode.

With emulate_invalid_guest_state=0 if a vcpu is in real mode VMX can
enter the vcpu with smaller segment limit than guest configured.  If the
guest tries to access pass this limit it will get #GP at which point
instruction will be emulated with correct segment limit applied. If
during the emulation IO is detected it is not handled correctly. Vcpu
thread should exit to userspace to serve the IO, but it returns to the
guest instead.  Since emulation is not completed till userspace completes
the IO the faulty instruction is re-executed ad infinitum.

The patch fixes that by exiting to userspace if IO happens during
instruction emulation.

Reported-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/vmx.c