• James Hogan's avatar
    MIPS: KVM: Fix preemptable kvm_mips_get_*_asid() calls · f049729c
    James Hogan authored
    There are a couple of places in KVM fault handling code which implicitly
    use smp_processor_id() via kvm_mips_get_kernel_asid() and
    kvm_mips_get_user_asid() from preemptable context. This is unsafe as a
    preemption could cause the guest kernel ASID to be changed, resulting in
    a host TLB entry being written with the wrong ASID.
    
    Fix by disabling preemption around the kvm_mips_get_*_asid() call and
    the corresponding kvm_mips_host_tlb_write().
    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: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    f049729c
tlb.c 19.8 KB