]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: mmu: Fix overflow on kvm mmu page limit calculation
authorBen Gardon <bgardon@google.com>
Mon, 8 Apr 2019 18:07:30 +0000 (11:07 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Apr 2019 13:37:30 +0000 (15:37 +0200)
commit851f5c99bea62a97a627ddb922b3ce773f0525d1
tree1b4b023ac429a1b0607e0f67c2d58cad725d3ea4
parent0257c3f7f9e97ff0cfe678ae32586c50cee3ce48
kvm: mmu: Fix overflow on kvm mmu page limit calculation

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>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c
arch/x86/kvm/mmu.h
arch/x86/kvm/x86.c