From 2b1575bde00938e0229cd7ba3c5b8382912a5144 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Tue, 12 Nov 2019 21:36:26 -0500 Subject: [PATCH] fixes for 4.9 Signed-off-by: Sasha Levin --- ...ad-pdptes-when-paging-is-not-enabled.patch | 45 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 46 insertions(+) create mode 100644 queue-4.9/kvm-mmu-don-t-read-pdptes-when-paging-is-not-enabled.patch create mode 100644 queue-4.9/series diff --git a/queue-4.9/kvm-mmu-don-t-read-pdptes-when-paging-is-not-enabled.patch b/queue-4.9/kvm-mmu-don-t-read-pdptes-when-paging-is-not-enabled.patch new file mode 100644 index 00000000000..835e8948c20 --- /dev/null +++ b/queue-4.9/kvm-mmu-don-t-read-pdptes-when-paging-is-not-enabled.patch @@ -0,0 +1,45 @@ +From 0cfe752a2fc083cc711f32cc1a13b8dece67776d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Nov 2019 15:50:19 -0800 +Subject: kvm: mmu: Don't read PDPTEs when paging is not enabled + +From: Junaid Shahid + +[ Upstream commit d35b34a9a70edae7ef923f100e51b8b5ae9fe899 ] + +kvm should not attempt to read guest PDPTEs when CR0.PG = 0 and +CR4.PAE = 1. + +Signed-off-by: Junaid Shahid +Signed-off-by: Paolo Bonzini +Signed-off-by: Sean Christopherson +Signed-off-by: Sasha Levin +--- + arch/x86/kvm/x86.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index 0b6517f5821be..384127a00328d 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -587,7 +587,7 @@ static bool pdptrs_changed(struct kvm_vcpu *vcpu) + gfn_t gfn; + int r; + +- if (is_long_mode(vcpu) || !is_pae(vcpu)) ++ if (is_long_mode(vcpu) || !is_pae(vcpu) || !is_paging(vcpu)) + return false; + + if (!test_bit(VCPU_EXREG_PDPTR, +@@ -7491,7 +7491,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, + kvm_update_cpuid(vcpu); + + idx = srcu_read_lock(&vcpu->kvm->srcu); +- if (!is_long_mode(vcpu) && is_pae(vcpu)) { ++ if (!is_long_mode(vcpu) && is_pae(vcpu) && is_paging(vcpu)) { + load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu)); + mmu_reset_needed = 1; + } +-- +2.20.1 + diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..684d9cc5ec5 --- /dev/null +++ b/queue-4.9/series @@ -0,0 +1 @@ +kvm-mmu-don-t-read-pdptes-when-paging-is-not-enabled.patch -- 2.47.3