Blackfin: fix MPU handling of invalid memory accesses
authorGraf Yang <graf.yang@analog.com>
Tue, 21 Jul 2009 02:26:57 +0000 (02:26 +0000)
committerMike Frysinger <vapier@gentoo.org>
Thu, 17 Sep 2009 01:31:55 +0000 (21:31 -0400)
The protect_page() function was incorrectly setting up the hardware tables
based on possible access capabilities rather than the actual requested
values.  This means we would grant more access to mmap-ed pages than we
should have.  Once we fix this, we need to tweak the signal generated by
such accesses to aline ourselves with other ports.  This allows the LTP
mmap0{5,6,7} cases to run properly.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/include/asm/mmu_context.h
arch/blackfin/kernel/traps.c

index 944e29faae48f4ba389450afe0d07e66a94b3cb5..040410bb07e1e5ac82c31095eebff76e31bc018d 100644 (file)
@@ -127,17 +127,17 @@ static inline void protect_page(struct mm_struct *mm, unsigned long addr,
        unsigned long idx = page >> 5;
        unsigned long bit = 1 << (page & 31);
 
-       if (flags & VM_MAYREAD)
+       if (flags & VM_READ)
                mask[idx] |= bit;
        else
                mask[idx] &= ~bit;
        mask += page_mask_nelts;
-       if (flags & VM_MAYWRITE)
+       if (flags & VM_WRITE)
                mask[idx] |= bit;
        else
                mask[idx] &= ~bit;
        mask += page_mask_nelts;
-       if (flags & VM_MAYEXEC)
+       if (flags & VM_EXEC)
                mask[idx] |= bit;
        else
                mask[idx] &= ~bit;
index 18c6cd4150f82df3636508f10d0f73e23382e597..644e35e335537bfd4b1ffda46c19d85b1caeb280 100644 (file)
@@ -411,7 +411,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
        /* 0x23 - Data CPLB protection violation, handled here */
        case VEC_CPLB_VL:
                info.si_code = ILL_CPLB_VI;
-               sig = SIGBUS;
+               sig = SIGSEGV;
                strerror = KERN_NOTICE EXC_0x23(KERN_NOTICE);
                CHK_DEBUGGER_TRAP_MAYBE();
                break;
This page took 0.026668 seconds and 5 git commands to generate.