]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.19.2/kvm-emulate-fix-cmpxchg8b-on-32-bit-hosts.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.2 / kvm-emulate-fix-cmpxchg8b-on-32-bit-hosts.patch
CommitLineData
103e869f
GKH
1From 4ff6f8e61eb7f96d3ca535c6d240f863ccd6fb7d Mon Sep 17 00:00:00 2001
2From: Paolo Bonzini <pbonzini@redhat.com>
3Date: Thu, 12 Feb 2015 17:04:47 +0100
4Subject: KVM: emulate: fix CMPXCHG8B on 32-bit hosts
5
6From: Paolo Bonzini <pbonzini@redhat.com>
7
8commit 4ff6f8e61eb7f96d3ca535c6d240f863ccd6fb7d upstream.
9
10This has been broken for a long time: it broke first in 2.6.35, then was
11almost fixed in 2.6.36 but this one-liner slipped through the cracks.
12The bug shows up as an infinite loop in Windows 7 (and newer) boot on
1332-bit hosts without EPT.
14
15Windows uses CMPXCHG8B to write to page tables, which causes a
16page fault if running without EPT; the emulator is then called from
17kvm_mmu_page_fault. The loop then happens if the higher 4 bytes are
18not 0; the common case for this is that the NX bit (bit 63) is 1.
19
20Fixes: 6550e1f165f384f3a46b60a1be9aba4bc3c2adad
21Fixes: 16518d5ada690643453eb0aef3cc7841d3623c2d
22Reported-by: Erik Rull <erik.rull@rdsoftware.de>
23Tested-by: Erik Rull <erik.rull@rdsoftware.de>
24Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
25Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27---
28 arch/x86/kvm/emulate.c | 3 ++-
29 1 file changed, 2 insertions(+), 1 deletion(-)
30
31--- a/arch/x86/kvm/emulate.c
32+++ b/arch/x86/kvm/emulate.c
33@@ -4863,7 +4863,8 @@ int x86_emulate_insn(struct x86_emulate_
34 if (rc != X86EMUL_CONTINUE)
35 goto done;
36 }
37- ctxt->dst.orig_val = ctxt->dst.val;
38+ /* Copy full 64-bit value for CMPXCHG8B. */
39+ ctxt->dst.orig_val64 = ctxt->dst.val64;
40
41 special_insn:
42