linux/arch/x86/kvm
Ben Gardon 3849fe3558 kvm: mmu: Fix overflow on kvm mmu page limit calculation
commit bc8a3d8925 upstream.

KVM bases its memory usage limits on the total number of guest pages
across all memslots. However, those limits, and the calculations to
produce them, use 32 bit unsigned integers. This can result in overflow
if a VM has more guest pages that can be represented by a u32. As a
result of this overflow, KVM can use a low limit on the number of MMU
pages it will allocate. This makes KVM unable to map all of guest memory
at once, prompting spurious faults.

Tested: Ran all kvm-unit-tests on an Intel Haswell machine. This patch
	introduced no new failures.

Signed-off-by: Ben Gardon <bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-08-13 12:39:08 +01:00
..
cpuid.c kvm: x86: IA32_ARCH_CAPABILITIES is always supported 2019-08-13 12:38:56 +01:00
cpuid.h x86/bugs: Add AMD's SPEC_CTRL MSR usage 2018-11-20 18:05:33 +00:00
emulate.c kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access 2018-09-25 23:47:24 +01:00
i8254.c KVM: i8254: change PIT discard tick policy 2016-05-01 00:05:53 +02:00
i8254.h KVM: fold kvm_pit_timer into kvm_kpit_state 2012-08-01 00:21:07 -03:00
i8259.c KVM: inject ExtINT interrupt before APIC interrupts 2012-12-13 23:05:21 -02:00
irq.c KVM: nVMX: fix "acknowledge interrupt on exit" when APICv is in use 2014-09-05 16:36:32 -07:00
irq.h KVM: switch to symbolic name for irq_states size 2012-07-20 16:12:16 -03:00
Kconfig kvm: make KVM_MMU_AUDIT help text more readable 2014-01-20 12:59:26 +01:00
kvm_cache_regs.h KVM: MMU: Do not unconditionally read PDPTE from guest memory 2011-09-25 19:18:01 +03:00
lapic.c KVM: x86: flush pending lapic jump label updates on module unload 2017-03-16 02:26:58 +00:00
lapic.h KVM: x86: flush pending lapic jump label updates on module unload 2017-03-16 02:26:58 +00:00
Makefile kvm: Add VFIO device 2013-10-30 19:02:03 +01:00
mmu.c kvm: mmu: Fix overflow on kvm mmu page limit calculation 2019-08-13 12:39:08 +01:00
mmu.h kvm: mmu: Fix overflow on kvm mmu page limit calculation 2019-08-13 12:39:08 +01:00
mmu_audit.c kvm: mmu: delay mmu audit activation 2013-11-20 11:12:56 +02:00
mmutrace.h KVM: MMU: add tracepoint for check_mmio_spte 2013-06-27 14:20:37 +03:00
paging_tmpl.h KVM: x86: MMU: fix ubsan index-out-of-range warning 2016-03-08 12:15:33 +00:00
pmu.c KVM: x86: Fix wrong/stuck PMU when guest does not use PMI 2014-04-23 17:46:52 -03:00
svm.c kvm: svm: Ensure an IBPB on all affected CPUs when freeing a vmcb 2019-02-11 17:54:14 +00:00
trace.h KVM: x86: correctly print #AC in traces 2016-02-02 17:29:13 +00:00
tss.h KVM: x86: hardware task switching support 2008-04-27 12:00:39 +03:00
vmx.c KVM: x86: Emulate MSR_IA32_ARCH_CAPABILITIES on AMD hosts 2019-08-13 12:38:57 +01:00
x86.c kvm: mmu: Fix overflow on kvm mmu page limit calculation 2019-08-13 12:39:08 +01:00
x86.h KVM: x86/mmu: Do not cache MMIO accesses while memslots are in flux 2019-07-09 22:04:04 +01:00