Skip to content

Commit 1d18ad0

Browse files
bsingharorampe
authored andcommitted
powerpc/mm: Detect instruction fetch denied and report
ISA 3 allows for prevention of instruction fetch and execution of user mode pages. If such an error occurs, SRR1 bit 35 reports the error. We catch and report the error in do_page_fault(). Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent ee97b6b commit 1d18ad0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/powerpc/mm/fault.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,12 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
390390
#endif /* CONFIG_8xx */
391391

392392
if (is_exec) {
393+
/*
394+
* An execution fault + no execute ?
395+
*/
396+
if (regs->msr & SRR1_ISI_N_OR_G)
397+
goto bad_area;
398+
393399
/*
394400
* Allow execution from readable areas if the MMU does not
395401
* provide separate controls over reading and executing.
@@ -404,6 +410,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
404410
(cpu_has_feature(CPU_FTR_NOEXECUTE) ||
405411
!(vma->vm_flags & (VM_READ | VM_WRITE))))
406412
goto bad_area;
413+
407414
#ifdef CONFIG_PPC_STD_MMU
408415
/*
409416
* protfault should only happen due to us

0 commit comments

Comments
 (0)