KVM: SVM: Restore correct registers after sel_cr0 intercept emulation
commitfb84c60fcdbcd33c162f2503aae1ac688ee2f4d2
authorJoerg Roedel <joerg.roedel@amd.com>
Thu, 2 Sep 2010 15:29:46 +0000 (2 17:29 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 22 Nov 2010 18:59:51 +0000 (22 10:59 -0800)
treef1ce2cd011a461deeddebbf131422117977a3a43
parentc0b67df56563d6e27b111fcf8cc8cf694ec4b87c
KVM: SVM: Restore correct registers after sel_cr0 intercept emulation

commit cda0008299a06f0d7218c6037c3c02d7a865e954 upstream.

This patch implements restoring of the correct rip, rsp, and
rax after the svm emulation in KVM injected a selective_cr0
write intercept into the guest hypervisor. The problem was
that the vmexit is emulated in the instruction emulation
which later commits the registers right after the write-cr0
instruction. So the l1 guest will continue to run with the
l2 rip, rsp and rax resulting in unpredictable behavior.

This patch is not the final word, it is just an easy patch
to fix the issue. The real fix will be done when the
instruction emulator is made aware of nested virtualization.
Until this is done this patch fixes the issue and provides
an easy way to fix this in -stable too.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/svm.c