FreeRTOS-Kernel/portable/GCC/ARM_CM3_MPU
Archit Gupta 83e56c38ee
Disallow unprivileged critical sections with MPU wrappers v2 (#1427)
When using MPU wrappers version 2 (configUSE_MPU_WRAPPERS_V1 == 0),
portRAISE_PRIVILEGE() is a no-op because the portSVC_RAISE_PRIVILEGE
handler is compiled only for MPU wrappers version 1. As a result, an
unprivileged task that calls taskENTER_CRITICAL() does not actually raise
its privilege, so the subsequent BASEPRI write is ignored by the hardware
and the critical section silently fails to mask interrupts. This produces
latent, hard-to-debug faults.

configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is therefore not supported with
MPU wrappers version 2. In the ARMv7-M MPU ports:

- When the option is left undefined under v2, default it to 0 instead of 1
  so the dangerous default configuration is safe.
- When the option is explicitly set to 1 under v2, raise a compile-time
  #error so the unsupported configuration is rejected loudly rather than
  failing silently at run time.

Behaviour for MPU wrappers version 1 is unchanged.
2026-06-15 15:30:25 -07:00
..
mpu_wrappers_v2_asm.c Fix AutoReload variable name (#1166) 2024-10-31 21:33:25 +05:30
port.c Disallow unprivileged critical sections with MPU wrappers v2 (#1427) 2026-06-15 15:30:25 -07:00
portmacro.h Fix the context array size for MPU ports (#1230) 2025-01-25 13:34:03 +05:30