From: Russell King Date: Sun, 20 Sep 2009 12:18:47 +0000 (+0100) Subject: ARM: Add support for checking access permissions on prefetch aborts X-Git-Tag: v2.6.32-rc1~49^2~1^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=df297bf6c7933e7b021cdc1bf3f9e319ea3a7e9c;p=karo-tx-linux.git ARM: Add support for checking access permissions on prefetch aborts ARMv6 introduces non-executable mappings, which can cause prefetch aborts when an attempt is made to execute from such a mapping. Currently, this causes us to loop in the page fault handler since we don't correctly check for proper permissions. Fix this by checking that VMAs have VM_EXEC set for prefetch aborts. Signed-off-by: Russell King --- diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index b7ce07d416cd..379f78556055 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -26,8 +26,9 @@ #include "fault.h" /* - * Fault status register encodings + * Fault status register encodings. We steal bit 31 for our own purposes. */ +#define FSR_LNX_PF (1 << 31) #define FSR_WRITE (1 << 11) #define FSR_FS4 (1 << 10) #define FSR_FS3_0 (15) @@ -205,6 +206,8 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) if (fsr & FSR_WRITE) mask = VM_WRITE; + if (fsr & FSR_LNX_PF) + mask = VM_EXEC; return vma->vm_flags & mask ? false : true; } @@ -503,7 +506,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) const struct fsr_info *inf = fsr_info + fsr_fs(fsr); struct siginfo info; - if (!inf->fn(addr, fsr, regs)) + if (!inf->fn(addr, fsr & ~FSR_LNX_PF, regs)) return; printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n", @@ -519,6 +522,6 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) asmlinkage void __exception do_PrefetchAbort(unsigned long addr, struct pt_regs *regs) { - do_translation_fault(addr, 0, regs); + do_translation_fault(addr, FSR_LNX_PF, regs); }