]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
arm/trap: Correctly update ftype from write access caused by a data abort
authorJulien Grall <julien.grall@linaro.org>
Fri, 6 Jun 2014 19:55:29 +0000 (20:55 +0100)
committerJulien Grall <julien.grall@linaro.org>
Sun, 12 Apr 2015 11:08:11 +0000 (12:08 +0100)
It's possible to mmap with only PROT_WRITE. This will result to a segfault
because the protection doesn't match the ftype.

See vm/vm_map.c vm_map_lookup

sys/arm/arm/trap.c

index 0f142ce06b5b97ebc9d0c8fc175820fa64c3d25b..ef965562be90e32361d795fc1e7bacbc6a80e1de 100644 (file)
@@ -326,7 +326,7 @@ abort_handler(struct trapframe *tf, int type)
         * disassemble the faulting instruction to determine if it was a write.
         */
 #if ARM_ARCH_6 || ARM_ARCH_7A
-       ftype = (fsr & FAULT_WNR) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ;
+       ftype = (fsr & FAULT_WNR) ? VM_PROT_WRITE : VM_PROT_READ;
 #else
        if (IS_PERMISSION_FAULT(fsr))
                ftype = VM_PROT_WRITE;