]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 6 Dec 2022 13:45:47 +0000 (14:45 +0100)
BugLink: https://bugs.launchpad.net/bugs/1998843
commit 055f37f84e304e59c046d1accfd8f08462f52c4c upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kvm/emulate.c

index 4749eded7490ff2938a634daf132e3f3c44e0b81..6c520ed32b5609c7b8a12638b30048ccdc8b2533 100644 (file)
@@ -2646,7 +2646,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);