]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.10.34/kvm-svm-fix-cr8-intercept-window.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.10.34 / kvm-svm-fix-cr8-intercept-window.patch
1 From 596f3142d2b7be307a1652d59e7b93adab918437 Mon Sep 17 00:00:00 2001
2 From: Radim Krčmář <rkrcmar@redhat.com>
3 Date: Tue, 11 Mar 2014 19:11:18 +0100
4 Subject: KVM: SVM: fix cr8 intercept window
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Radim Krčmář <rkrcmar@redhat.com>
10
11 commit 596f3142d2b7be307a1652d59e7b93adab918437 upstream.
12
13 We always disable cr8 intercept in its handler, but only re-enable it
14 if handling KVM_REQ_EVENT, so there can be a window where we do not
15 intercept cr8 writes, which allows an interrupt to disrupt a higher
16 priority task.
17
18 Fix this by disabling intercepts in the same function that re-enables
19 them when needed. This fixes BSOD in Windows 2008.
20
21 Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
22 Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
23 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 arch/x86/kvm/svm.c | 6 +++---
28 1 file changed, 3 insertions(+), 3 deletions(-)
29
30 --- a/arch/x86/kvm/svm.c
31 +++ b/arch/x86/kvm/svm.c
32 @@ -2985,10 +2985,8 @@ static int cr8_write_interception(struct
33 u8 cr8_prev = kvm_get_cr8(&svm->vcpu);
34 /* instruction emulation calls kvm_set_cr8() */
35 r = cr_interception(svm);
36 - if (irqchip_in_kernel(svm->vcpu.kvm)) {
37 - clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
38 + if (irqchip_in_kernel(svm->vcpu.kvm))
39 return r;
40 - }
41 if (cr8_prev <= kvm_get_cr8(&svm->vcpu))
42 return r;
43 kvm_run->exit_reason = KVM_EXIT_SET_TPR;
44 @@ -3550,6 +3548,8 @@ static void update_cr8_intercept(struct
45 if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK))
46 return;
47
48 + clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
49 +
50 if (irr == -1)
51 return;
52