]>
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:00 +0300 |
f6df304f TL |
4 | Subject: [PATCH] KVM: x86: emulator: em_sysexit should update ctxt->mode |
5 | ||
6 | This is one of the instructions that can change the | |
7 | processor mode. | |
8 | ||
9 | Note that this is likely a benign bug, because the only problematic | |
10 | mode change is from 32 bit to 64 bit which can lead to truncation of RIP, | |
11 | and it is not possible to do with sysexit, | |
12 | since sysexit running in 32 bit mode will be limited to 32 bit version. | |
13 | ||
14 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> | |
15 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
16 | --- | |
17 | arch/x86/kvm/emulate.c | 1 + | |
18 | 1 file changed, 1 insertion(+) | |
19 | ||
20 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c | |
3ae8384f | 21 | index 89b11e7dca8a..93349b54ef56 100644 |
f6df304f TL |
22 | --- a/arch/x86/kvm/emulate.c |
23 | +++ b/arch/x86/kvm/emulate.c | |
3ae8384f | 24 | @@ -2875,6 +2875,7 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt) |
f6df304f TL |
25 | ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); |
26 | ||
27 | ctxt->_eip = rdx; | |
28 | + ctxt->mode = usermode; | |
29 | *reg_write(ctxt, VCPU_REGS_RSP) = rcx; | |
30 | ||
31 | return X86EMUL_CONTINUE; |