• Ben Gardon's avatar
    kvm: mmu: Fix overflow on kvm mmu page limit calculation · 163b24b1
    Ben Gardon authored
    [ Upstream commit bc8a3d89 ]
    
    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>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    163b24b1
mmu.h 7.31 KB