From abcda9133e6871a3f9ece217a1ecf016404efcc4 Mon Sep 17 00:00:00 2001
From: Julien Grall <julien.grall@linaro.org>
Date: Fri, 6 Jun 2014 20:55:29 +0100
Subject: [PATCH 37/48] arm/trap: Correctly update ftype from write access
 caused by a data abort

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm/arm/trap.c b/sys/arm/arm/trap.c
index ec14feb..302ac4f 100644
--- a/sys/arm/arm/trap.c
+++ b/sys/arm/arm/trap.c
@@ -320,7 +320,7 @@ data_abort_handler(struct trapframe *tf)
 	 * 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;
-- 
2.1.0

