]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
MIPS: KVM: Fix mapped fault broken commpage handling
authorJames Hogan <james.hogan@imgtec.com>
Thu, 18 Aug 2016 09:05:29 +0000 (10:05 +0100)
committerKamal Mostafa <kamal@canonical.com>
Mon, 22 Aug 2016 14:42:31 +0000 (07:42 -0700)
commit5585ee4f59b06cd1072fd2844cbb70389afa93c3
tree56fd7ab75f397165866b67c80dcf7ced1c756a9f
parent1ae950dfc70b1ad61cc79c3d5718a19f09238fbe
MIPS: KVM: Fix mapped fault broken commpage handling

BugLink: http://bugs.launchpad.net/bugs/1615620
commit c604cffa93478f8888bec62b23d6073dad03d43a upstream.

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 42aa12e74e91 ("MIPS: KVM: Move
commpage so 0x0 is unmapped")), and set the corresponding EntryLo to be
interpreted as 0 (invalid).

Fixes: 858dd5d45733 ("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
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
[james.hogan@imgtec.com: Backport to v3.17.y - v4.4.y]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
arch/mips/kvm/tlb.c