]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0023-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch
update sources to Ubuntu-5.19.0-14.14
[pve-kernel.git] / patches / kernel / 0023-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch
CommitLineData
54ebe3cb
TL
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Maxim Levitsky <mlevitsk@redhat.com>
3Date: Tue, 21 Jun 2022 18:08:55 +0300
4Subject: [PATCH] KVM: x86: emulator: update the emulation mode after rsm
5
6This ensures that RIP will be correctly written back,
7because the RSM instruction can switch the CPU mode from
832 bit (or less) to 64 bit.
9
10This fixes a guest crash in case the #SMI is received
11while the guest runs a code from an address > 32 bit.
12
13Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
14Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15---
16 arch/x86/kvm/emulate.c | 5 +++++
17 1 file changed, 5 insertions(+)
18
19diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
20index c4e3f9103870..03a761397599 100644
21--- a/arch/x86/kvm/emulate.c
22+++ b/arch/x86/kvm/emulate.c
23@@ -2650,6 +2650,11 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt)
24 if (ret != X86EMUL_CONTINUE)
25 goto emulate_shutdown;
26
27+
28+ ret = update_emulation_mode(ctxt);
29+ if (ret != X86EMUL_CONTINUE)
30+ goto emulate_shutdown;
31+
32 /*
33 * Note, the ctxt->ops callbacks are responsible for handling side
34 * effects when writing MSRs and CRs, e.g. MMU context resets, CPUID