Patch "powerpc/mm: Fix false detection of read faults" has been added to the 6.1-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

    powerpc/mm: Fix false detection of read faults

to the 6.1-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:
     powerpc-mm-fix-false-detection-of-read-faults.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 716f963e097b7c4b95c78e7a8bdd6f87703a3456
Author: Russell Currey <ruscur@xxxxxxxxxx>
Date:   Fri Mar 10 16:08:34 2023 +1100

    powerpc/mm: Fix false detection of read faults
    
    [ Upstream commit f2c7e3562b4c4f1699acc1538ebf3e75f5cced35 ]
    
    To support detection of read faults with Radix execute-only memory, the
    vma_is_accessible() check in access_error() (which checks for PROT_NONE)
    was replaced with a check to see if VM_READ was missing, and if so,
    returns true to assert the fault was caused by a bad read.
    
    This is incorrect, as it ignores that both VM_WRITE and VM_EXEC imply
    read on powerpc, as defined in protection_map[].  This causes mappings
    containing VM_WRITE or VM_EXEC without VM_READ to misreport the cause of
    page faults, since the MMU is still allowing reads.
    
    Correct this by restoring the original vma_is_accessible() check for
    PROT_NONE mappings, and adding a separate check for Radix PROT_EXEC-only
    mappings.
    
    Fixes: 395cac7752b9 ("powerpc/mm: Support execute-only memory on the Radix MMU")
    Reported-by: Michal Suchánek <msuchanek@xxxxxxx>
    Link: https://lore.kernel.org/r/20230308152702.GR19419@xxxxxxxxxxxxxxx
    Tested-by: Benjamin Gray <bgray@xxxxxxxxxxxxx>
    Signed-off-by: Russell Currey <ruscur@xxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://msgid.link/20230310050834.63105-1-ruscur@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 2bef19cc1b98c..af46aa88422bf 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -271,11 +271,16 @@ static bool access_error(bool is_write, bool is_exec, struct vm_area_struct *vma
 	}
 
 	/*
-	 * Check for a read fault.  This could be caused by a read on an
-	 * inaccessible page (i.e. PROT_NONE), or a Radix MMU execute-only page.
+	 * VM_READ, VM_WRITE and VM_EXEC all imply read permissions, as
+	 * defined in protection_map[].  Read faults can only be caused by
+	 * a PROT_NONE mapping, or with a PROT_EXEC-only mapping on Radix.
 	 */
-	if (unlikely(!(vma->vm_flags & VM_READ)))
+	if (unlikely(!vma_is_accessible(vma)))
 		return true;
+
+	if (unlikely(radix_enabled() && ((vma->vm_flags & VM_ACCESS_FLAGS) == VM_EXEC)))
+		return true;
+
 	/*
 	 * We should ideally do the vma pkey access check here. But in the
 	 * fault path, handle_mm_fault() also does the same check. To avoid



[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