aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/fault.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-07-18 20:00:20 -0400
committerPaul Mackerras <paulus@samba.org>2007-07-22 07:30:58 -0400
commit08ae6cc15db201fa20cc4893d9500c1f6b20e560 (patch)
tree4db5882987a63cc6d73a08cbc6af11f4ea13ff6b /arch/powerpc/mm/fault.c
parentca8ffc974d43033be6e1d4277a45822d2c3656f4 (diff)
[POWERPC] Allow exec faults on readable areas on classic 32-bit PowerPC
Classic 32-bit PowerPC CPUs, and the early 64-bit PowerPC CPUs, don't provide a way to prevent execution from readable pages, that is, the MMU doesn't distinguish between data reads and instruction reads, although a different exception is taken for faults in data accesses and instruction accesses. Commit 9ba4ace39fdfe22268daca9f28c5df384ae462cf, in the course of fixing another bug, added a check that meant that a page fault due to an instruction access would fail if the vma did not have the VM_EXEC flag set. This gives an inconsistent enforcement on these CPUs of the no-execute status of the vma (since reading from the page is sufficient to allow subsequent execution from it), and causes old versions of ppc32 glibc (2.2 and earlier) to fail, since they rely on executing the word before the GOT but don't have it marked executable. This fixes the problem by allowing execution from readable (or writable) areas on CPUs which do not provide separate control over data and instruction reads. Signed-off-by: Paul Mackerras <paulus@samba.org> Acked-by: Jon Loeliger <jdl@freescale.com>
Diffstat (limited to 'arch/powerpc/mm/fault.c')
-rw-r--r--arch/powerpc/mm/fault.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 3767211b3d0f..ab3546c5ac3a 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -283,7 +283,13 @@ good_area:
283 /* protection fault */ 283 /* protection fault */
284 if (error_code & DSISR_PROTFAULT) 284 if (error_code & DSISR_PROTFAULT)
285 goto bad_area; 285 goto bad_area;
286 if (!(vma->vm_flags & VM_EXEC)) 286 /*
287 * Allow execution from readable areas if the MMU does not
288 * provide separate controls over reading and executing.
289 */
290 if (!(vma->vm_flags & VM_EXEC) &&
291 (cpu_has_feature(CPU_FTR_NOEXECUTE) ||
292 !(vma->vm_flags & (VM_READ | VM_WRITE))))
287 goto bad_area; 293 goto bad_area;
288#else 294#else
289 pte_t *ptep; 295 pte_t *ptep;