KVM: SVM: check for progress after IRET interception
authorAvi Kivity <avi@redhat.com>
Thu, 3 Feb 2011 13:29:52 +0000 (15:29 +0200)
committerSteve Conklin <sconklin@canonical.com>
Thu, 2 Jun 2011 19:23:16 +0000 (14:23 -0500)
commitefbe7400bea5296a57271cad210cd2a1b3fdcaaf
treef906862fb1b898f3ad0f5bb5a0cf4c647dd69511
parent5fddb87635550a8cdf5f31be40026de60627aa53
KVM: SVM: check for progress after IRET interception

BugLink: http://bugs.launchpad.net/bugs/780546

commit bd3d1ec3d26b61120bb4f60b18ee99aa81839e6b upstream.

When we enable an NMI window, we ask for an IRET intercept, since
the IRET re-enables NMIs.  However, the IRET intercept happens before
the instruction executes, while the NMI window architecturally opens
afterwards.

To compensate for this mismatch, we only open the NMI window in the
following exit, assuming that the IRET has by then executed; however,
this assumption is not always correct; we may exit due to a host interrupt
or page fault, without having executed the instruction.

Fix by checking for forward progress by recording and comparing the IRET's
rip.  This is somewhat of a hack, since an unchaging rip does not mean that
no forward progress has been made, but is the simplest fix for now.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/x86/kvm/svm.c