Browse Source

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>
Balbir Singh 8 years ago
parent
commit
1d18ad0268
1 changed files with 7 additions and 0 deletions
  1. 7 0
      arch/powerpc/mm/fault.c

+ 7 - 0
arch/powerpc/mm/fault.c

@@ -390,6 +390,12 @@ good_area:
 #endif /* CONFIG_8xx */
 #endif /* CONFIG_8xx */
 
 
 	if (is_exec) {
 	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
 		 * Allow execution from readable areas if the MMU does not
 		 * provide separate controls over reading and executing.
 		 * provide separate controls over reading and executing.
@@ -404,6 +410,7 @@ good_area:
 		    (cpu_has_feature(CPU_FTR_NOEXECUTE) ||
 		    (cpu_has_feature(CPU_FTR_NOEXECUTE) ||
 		     !(vma->vm_flags & (VM_READ | VM_WRITE))))
 		     !(vma->vm_flags & (VM_READ | VM_WRITE))))
 			goto bad_area;
 			goto bad_area;
+
 #ifdef CONFIG_PPC_STD_MMU
 #ifdef CONFIG_PPC_STD_MMU
 		/*
 		/*
 		 * protfault should only happen due to us
 		 * protfault should only happen due to us