]>
Commit | Line | Data |
---|---|---|
f6df304f TL |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Maxim Levitsky <mlevitsk@redhat.com> | |
83250735 | 3 | Date: Wed, 3 Aug 2022 18:50:02 +0300 |
f6df304f TL |
4 | Subject: [PATCH] KVM: x86: emulator: update the emulation mode after rsm |
5 | ||
6 | This ensures that RIP will be correctly written back, | |
7 | because the RSM instruction can switch the CPU mode from | |
8 | 32 bit (or less) to 64 bit. | |
9 | ||
10 | This fixes a guest crash in case the #SMI is received | |
11 | while the guest runs a code from an address > 32 bit. | |
12 | ||
13 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> | |
14 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
15 | --- | |
16 | arch/x86/kvm/emulate.c | 5 +++++ | |
17 | 1 file changed, 5 insertions(+) | |
18 | ||
19 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c | |
83250735 | 20 | index 6a597d68d456..49697d589f87 100644 |
f6df304f TL |
21 | --- a/arch/x86/kvm/emulate.c |
22 | +++ b/arch/x86/kvm/emulate.c | |
83250735 | 23 | @@ -2639,6 +2639,11 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) |
f6df304f TL |
24 | if (ret != X86EMUL_CONTINUE) |
25 | goto emulate_shutdown; | |
26 | ||
27 | + | |
83250735 | 28 | + ret = emulator_recalc_and_set_mode(ctxt); |
f6df304f TL |
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 |