Skip to content
Commit 34f38378 authored by Maureen Helm's avatar Maureen Helm Committed by Anas Nashif
Browse files

arch: arm: mpu: Lock irqs while reprogramming the nxp mpu



The nxp mpu uses the logical OR of access permissions when multiple
region descriptors apply to a given memory access. This means that we
must partition the sram into two non-overlapping regions to implement
the mpu stack guard. This partitioning gets reconfigured at every
context switch, and if an interrupt occurs during this time, it can
cause a fault because we do not have a valid mpu region descriptor for
the sram.

This scenario was observed on frdm_k64f in tests/posix/common before
commit 2895da02, which changed timing.
In this case, we couldn't even print fault information to the console
and the hardware would reset. It looked a lot like a watchdog reset,
unless you attached a debugger to see the fault.

A similar problem was fixed in commit
ec424b7a, but this change temporarily
disabled the mpu.

Fix both cases by locking interrupts during the critical sections, as
this is more secure than disabling the mpu.

Signed-off-by: default avatarMaureen Helm <maureen.helm@nxp.com>
parent a94f2b0b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment