diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index fa921e39b84..226f6959295 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -318,8 +318,16 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, ftype = VM_PROT_EXECUTE; break; default: - ftype = (esr & ISS_DATA_WnR) == 0 ? VM_PROT_READ : - VM_PROT_WRITE; + /* + * If the exception was because of a read or cache operation + * pass a read fault type into the vm code. Cache operations + * need read permission but will set the WnR flag when the + * memory is unmapped. + */ + if ((esr & ISS_DATA_WnR) == 0 || (esr & ISS_DATA_CM) != 0) + ftype = VM_PROT_READ; + else + ftype = VM_PROT_WRITE; break; }