• Joerg Roedel's avatar
    KVM: SVM: Restore correct registers after sel_cr0 intercept emulation · cda00082
    Joerg Roedel authored
    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.
    
    Cc: stable@kernel.org
    Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
    Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    cda00082
svm.c 92.3 KB