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
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 From: Radim Krčmář <rkrcmar@redhat.com>
11 commit 596f3142d2b7be307a1652d59e7b93adab918437 upstream.
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
18 Fix this by disabling intercepts in the same function that re-enables
19 them when needed. This fixes BSOD in Windows 2008.
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>
27 arch/x86/kvm/svm.c | 6 +++---
28 1 file changed, 3 insertions(+), 3 deletions(-)
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))
41 if (cr8_prev <= kvm_get_cr8(&svm->vcpu))
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))
48 + clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);