• Ben Gardon's avatar
    kvm: mmu: Fix overflow on kvm mmu page limit calculation · bc8a3d89
    Ben Gardon authored
    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: default avatarBen Gardon <bgardon@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    bc8a3d89
kvm_host.h 46 KB