]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.1/kvm-mtrr-remove-msr-0x2f8.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.1 / kvm-mtrr-remove-msr-0x2f8.patch
1 From 9842df62004f366b9fed2423e24df10542ee0dc5 Mon Sep 17 00:00:00 2001
2 From: Andy Honig <ahonig@google.com>
3 Date: Tue, 17 May 2016 17:41:47 +0200
4 Subject: KVM: MTRR: remove MSR 0x2f8
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Andy Honig <ahonig@google.com>
10
11 commit 9842df62004f366b9fed2423e24df10542ee0dc5 upstream.
12
13 MSR 0x2f8 accessed the 124th Variable Range MTRR ever since MTRR support
14 was introduced by 9ba075a664df ("KVM: MTRR support").
15
16 0x2f8 became harmful when 910a6aae4e2e ("KVM: MTRR: exactly define the
17 size of variable MTRRs") shrinked the array of VR MTRRs from 256 to 8,
18 which made access to index 124 out of bounds. The surrounding code only
19 WARNs in this situation, thus the guest gained a limited read/write
20 access to struct kvm_arch_vcpu.
21
22 0x2f8 is not a valid VR MTRR MSR, because KVM has/advertises only 16 VR
23 MTRR MSRs, 0x200-0x20f. Every VR MTRR is set up using two MSRs, 0x2f8
24 was treated as a PHYSBASE and 0x2f9 would be its PHYSMASK, but 0x2f9 was
25 not implemented in KVM, therefore 0x2f8 could never do anything useful
26 and getting rid of it is safe.
27
28 This fixes CVE-2016-3713.
29
30 Fixes: 910a6aae4e2e ("KVM: MTRR: exactly define the size of variable MTRRs")
31 Reported-by: David Matlack <dmatlack@google.com>
32 Signed-off-by: Andy Honig <ahonig@google.com>
33 Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
34 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36
37 ---
38 arch/x86/kvm/mtrr.c | 2 --
39 1 file changed, 2 deletions(-)
40
41 --- a/arch/x86/kvm/mtrr.c
42 +++ b/arch/x86/kvm/mtrr.c
43 @@ -44,8 +44,6 @@ static bool msr_mtrr_valid(unsigned msr)
44 case MSR_MTRRdefType:
45 case MSR_IA32_CR_PAT:
46 return true;
47 - case 0x2f8:
48 - return true;
49 }
50 return false;
51 }