• James Hogan's avatar
    MIPS: KVM: Include bit 31 in segment matches · 7f5a1ddc
    James Hogan authored
    When faulting guest addresses are matched against guest segments with
    the KVM_GUEST_KSEGX() macro, change the mask to 0xe0000000 so as to
    include bit 31.
    
    This is mainly for safety's sake, as it prevents a rogue BadVAddr in the
    host kseg2/kseg3 segments (e.g. 0xC*******) after a TLB exception from
    matching the guest kseg0 segment (e.g. 0x4*******), triggering an
    internal KVM error instead of allowing the corresponding guest kseg0
    page to be mapped into the host vmalloc space.
    
    Such a rogue BadVAddr was observed to happen with the host MIPS kernel
    running under QEMU with KVM built as a module, due to a not entirely
    transparent optimisation in the QEMU TLB handling. This has already been
    worked around properly in a previous commit.
    Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Radim Krčmář <rkrcmar@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: kvm@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    7f5a1ddc
kvm_host.h 27.6 KB