]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
s390/pci_mmio: fully validate the VMA before calling follow_pte()
authorDavid Hildenbrand <david@redhat.com>
Thu, 9 Sep 2021 14:59:42 +0000 (16:59 +0200)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Wed, 27 Oct 2021 23:04:20 +0000 (17:04 -0600)
commit7c8cde22d37f7265dac738d9f05ad8de1d568234
tree1b09b67f3f1b3653b8480dc04ea33b315cc30a3a
parentfbeffffec4da78aa1f9b731aaae3a69f10e36504
s390/pci_mmio: fully validate the VMA before calling follow_pte()

BugLink: https://bugs.launchpad.net/bugs/1947885
commit a8b92b8c1eac8d655a97b1e90f4d83c25d9b9a18 upstream.

We should not walk/touch page tables outside of VMA boundaries when
holding only the mmap sem in read mode. Evil user space can modify the
VMA layout just before this function runs and e.g., trigger races with
page table removal code since commit dd2283f2605e ("mm: mmap: zap pages
with read mmap_sem in munmap").

find_vma() does not check if the address is >= the VMA start address;
use vma_lookup() instead.

Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
arch/s390/pci/pci_mmio.c