Patch "s390/pci_mmio: fully validate the VMA before calling follow_pte()" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390/pci_mmio: fully validate the VMA before calling follow_pte()

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-pci_mmio-fully-validate-the-vma-before-calling-.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 15ba9e32b57b24b3fee0c6129e9dc4595c44b4e8
Author: David Hildenbrand <david@xxxxxxxxxx>
Date:   Thu Sep 9 16:59:42 2021 +0200

    s390/pci_mmio: fully validate the VMA before calling follow_pte()
    
    [ Upstream commit a8b92b8c1eac8d655a97b1e90f4d83c25d9b9a18 ]
    
    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@xxxxxxxxxxxxx>
    Reviewed-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
    Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
    Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
    Signed-off-by: Vasily Gorbik <gor@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
index ae683aa623ac..c5b35ea129cf 100644
--- a/arch/s390/pci/pci_mmio.c
+++ b/arch/s390/pci/pci_mmio.c
@@ -159,7 +159,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
 
 	mmap_read_lock(current->mm);
 	ret = -EINVAL;
-	vma = find_vma(current->mm, mmio_addr);
+	vma = vma_lookup(current->mm, mmio_addr);
 	if (!vma)
 		goto out_unlock_mmap;
 	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
@@ -298,7 +298,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
 
 	mmap_read_lock(current->mm);
 	ret = -EINVAL;
-	vma = find_vma(current->mm, mmio_addr);
+	vma = vma_lookup(current->mm, mmio_addr);
 	if (!vma)
 		goto out_unlock_mmap;
 	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux