]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
c6330e5eea2686834912d857fb744c448d7e4e59
[thirdparty/kernel/stable-queue.git] /
1 From 37b95951c58fdf08dc10afa9d02066ed9f176fb5 Mon Sep 17 00:00:00 2001
2 From: Tianyu Lan <lantianyu1986@gmail.com>
3 Date: Tue, 16 Jan 2018 17:34:07 +0800
4 Subject: KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs()
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Tianyu Lan <lantianyu1986@gmail.com>
10
11 commit 37b95951c58fdf08dc10afa9d02066ed9f176fb5 upstream.
12
13 kvm_valid_sregs() should use X86_CR0_PG and X86_CR4_PAE to check bit
14 status rather than X86_CR0_PG_BIT and X86_CR4_PAE_BIT. This patch is
15 to fix it.
16
17 Fixes: f29810335965a(KVM/x86: Check input paging mode when cs.l is set)
18 Reported-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
19 Cc: Paolo Bonzini <pbonzini@redhat.com>
20 Cc: Radim Krčmář <rkrcmar@redhat.com>
21 Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
22 Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
23 Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 arch/x86/kvm/x86.c | 4 ++--
28 1 file changed, 2 insertions(+), 2 deletions(-)
29
30 --- a/arch/x86/kvm/x86.c
31 +++ b/arch/x86/kvm/x86.c
32 @@ -7482,13 +7482,13 @@ EXPORT_SYMBOL_GPL(kvm_task_switch);
33
34 int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
35 {
36 - if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG_BIT)) {
37 + if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) {
38 /*
39 * When EFER.LME and CR0.PG are set, the processor is in
40 * 64-bit mode (though maybe in a 32-bit code segment).
41 * CR4.PAE and EFER.LMA must be set.
42 */
43 - if (!(sregs->cr4 & X86_CR4_PAE_BIT)
44 + if (!(sregs->cr4 & X86_CR4_PAE)
45 || !(sregs->efer & EFER_LMA))
46 return -EINVAL;
47 } else {