]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: KVM: Fix mapped fault broken commpage handling
authorJames Hogan <james.hogan@imgtec.com>
Thu, 11 Aug 2016 10:58:12 +0000 (11:58 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Fri, 12 Aug 2016 10:01:28 +0000 (12:01 +0200)
commitf5f94a72d904cddb0cb848b7bebdaf66159115e4
tree9701dba5cce0491bb6ba15f183239d7e6cc07a10
parentcd8ed5d31a601249ae8dc7199aac64d1f2a671d6
MIPS: KVM: Fix mapped fault broken commpage handling

kvm_mips_handle_mapped_seg_tlb_fault() appears to map the guest page at
virtual address 0 to PFN 0 if the guest has created its own mapping
there. The intention is unclear, but it may have been an attempt to
protect the zero page from being mapped to anything but the comm page in
code paths you wouldn't expect from genuine commpage accesses (guest
kernel mode cache instructions on that address, hitting trapping
instructions when executing from that address with a coincidental TLB
eviction during the KVM handling, and guest user mode accesses to that
address).

Fix this to check for mappings exactly at KVM_GUEST_COMMPAGE_ADDR (it
may not be at address 0 since commit 0b30eecacb83 ("MIPS: KVM: Move
commpage so 0x0 is unmapped")), and set the corresponding EntryLo to be
interpreted as 0 (invalid).

Fixes: 3c4d0808d3e8 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
Signed-off-by: James 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
Cc: <stable@vger.kernel.org> # 3.10.x-
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/mips/kvm/mmu.c