| 123456789101112131415161718192021222324252627282930313233 |
- From 6d83f3690f8f3026df587db2264f0917ba747de9 Mon Sep 17 00:00:00 2001
- From: Maxim Levitsky <[email protected]>
- Date: Tue, 25 Oct 2022 15:47:30 +0300
- Subject: [PATCH] KVM: x86: emulator: update the emulation mode after rsm
- 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 <[email protected]>
- ---
- arch/x86/kvm/emulate.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
- index d75d33d60cb8..4365137d823b 100644
- --- a/arch/x86/kvm/emulate.c
- +++ b/arch/x86/kvm/emulate.c
- @@ -2313,7 +2313,7 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt)
- if (ctxt->ops->leave_smm(ctxt))
- ctxt->ops->triple_fault(ctxt);
-
- - return X86EMUL_CONTINUE;
- + return emulator_recalc_and_set_mode(ctxt);
- }
-
- static void
- --
- 2.38.1
|