Skip to content

Commit

Permalink
powerpc/mm: Detect instruction fetch denied and report
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Balbir Singh authored and Michael Ellerman committed Nov 25, 2016
1 parent ee97b6b commit 1d18ad0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/powerpc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
#endif /* CONFIG_8xx */

if (is_exec) {
/*
* An execution fault + no execute ?
*/
if (regs->msr & SRR1_ISI_N_OR_G)
goto bad_area;

/*
* Allow execution from readable areas if the MMU does not
* provide separate controls over reading and executing.
Expand All @@ -404,6 +410,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
(cpu_has_feature(CPU_FTR_NOEXECUTE) ||
!(vma->vm_flags & (VM_READ | VM_WRITE))))
goto bad_area;

#ifdef CONFIG_PPC_STD_MMU
/*
* protfault should only happen due to us
Expand Down

0 comments on commit 1d18ad0

Please sign in to comment.