This is a note to let you know that I've just added the patch titled KVM: x86: emulator: update the emulation mode after rsm to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kvm-x86-emulator-update-the-emulation-mode-after-rsm.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 055f37f84e304e59c046d1accfd8f08462f52c4c Mon Sep 17 00:00:00 2001 From: Maxim Levitsky <mlevitsk@xxxxxxxxxx> Date: Tue, 25 Oct 2022 15:47:30 +0300 Subject: KVM: x86: emulator: update the emulation mode after rsm From: Maxim Levitsky <mlevitsk@xxxxxxxxxx> 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@xxxxxxxxxx> Message-Id: <20221025124741.228045-13-mlevitsk@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2646,7 +2646,7 @@ static int em_rsm(struct x86_emulate_ctx * 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); Patches currently in stable-queue which might be from mlevitsk@xxxxxxxxxx are queue-5.15/kvm-x86-emulator-update-the-emulation-mode-after-cr0-write.patch queue-5.15/kvm-x86-treat-dbs-from-the-emulator-as-fault-like-co.patch queue-5.15/kvm-x86-emulator-update-the-emulation-mode-after-rsm.patch queue-5.15/kvm-x86-emulator-introduce-emulator_recalc_and_set_mode.patch queue-5.15/kvm-x86-emulator-em_sysexit-should-update-ctxt-mode.patch queue-5.15/kvm-x86-trace-re-injected-exceptions.patch