]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: x86: emulator: update the emulation mode after rsm
authorMaxim Levitsky <mlevitsk@redhat.com>
Tue, 25 Oct 2022 12:47:30 +0000 (15:47 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Oct 2022 10:10:29 +0000 (06:10 -0400)
Update the emulation mode after RSM so that RIP will be correctly
written back, because the RSM instruction can switch the CPU mode from
32 bit (or less) to 64 bit.

This fixes a guest crash in case the #SMI is received while the guest
runs a code from an address > 32 bit.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20221025124741.228045-13-mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c

index e5522a23d985651b17a94448d2539acf01ea2742..33385ebae1004403d17a980940d8d905c9210aac 100644 (file)
@@ -2662,7 +2662,7 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt)
         * those side effects need to be explicitly handled for both success
         * and shutdown.
         */
-       return X86EMUL_CONTINUE;
+       return emulator_recalc_and_set_mode(ctxt);
 
 emulate_shutdown:
        ctxt->ops->triple_fault(ctxt);