]> 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)
commit6e9263c00eb739bc29f98f7433d3b33a8d1d72c9
tree1b4b023ac429a1b0607e0f67c2d58cad725d3ea4
parent260b7347b77cc89b5b830c04e9b2a3b8e96f4f57
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