powerpc/mm: Update PROTFAULT handling in the page fault path
PATCH 1/1 powerpc/mm: Update PROTFAULT handling in the page fault path
With radix, we can get page fault with DSISR_PROTFAULT value set in case of PROT_NONE or autonuma mapping. The PROT_NONE case in handled by the vma check where we consider the access bad. For autonuma we should fall through and fixup the access mask correctly.
Without this patch we trigger the WARN_ON() on radix. This code moves that WARN_ON() within a radix_enabled() check. I also moved the WARN_ON() outside the if condition making it apply for all type of faults (exec/write/read). It is also conditionalized for book3s, because BOOK3E can also get a PROTFAULT to handle the D/I cache sync.
--- arch/powerpc/mm/copro_fault.c | 10 ++++++---- arch/powerpc/mm/fault.c | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 14 deletions(-)
arch/powerpc/mm/copro_fault.c +6 -4
@@ -67,11 +67,13 @@ int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,if (!(vma->vm_flags & (VM_READ |VM_EXEC ))) goto out_unlock;/* -* protfault should only happen due to us -* mapping a region readonly temporarily. PROT_NONE -* is also covered by the VMA check above. +* PROT_NONE is covered by the VMA check above. +* and hash should get a NOHPTE fault instead of +* a PROTFAULT in case fixup is needed for things +* like autonuma. */ -WARN_ON_ONCE (dsisr &DSISR_PROTFAULT ); +if (!radix_enabled ()) +WARN_ON_ONCE (dsisr &DSISR_PROTFAULT ); } ret =0 ;
arch/powerpc/mm/fault.c +33 -10
56 lines not on this page · raw message
Signature · 1 line
2.10.2
Michael Ellerman
AppliedQuoted 5 lines · Aneesh Kumar K.V
With radix, we can get page fault with
DSISR_PROTFAULTvalue set in case ofPROT_NONEor autonuma mapping. ThePROT_NONEcase in handled by the vma check where we consider the access bad. For autonuma we should fall through and fixup the access mask correctly.
Quoted 7 lines
Without this patch we trigger the
WARN_ON()on radix. This code moves thatWARN_ON()within aradix_enabled()check. I also moved theWARN_ON()outside the if condition making it apply for all type of faults (exec/write/read). It is also conditionalized for book3s, because BOOK3E can also get a PROTFAULT to handle the D/I cache sync.Signed-off-by Aneesh Kumar K.V <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/18061c17c8ecdbdbf1e7d1695ec44e
cheers