]> begriffs open source - freertos/commit
Fix portSWITCH_TO_USER_MODE() on Armv7-M MPU ports (#803)
authorSoren Ptak <ptaksoren@gmail.com>
Tue, 26 Sep 2023 09:06:23 +0000 (02:06 -0700)
committerGitHub <noreply@github.com>
Tue, 26 Sep 2023 09:06:23 +0000 (14:36 +0530)
commit84bdb05bd284b9ef4c465331c9921200c5ee7bd6
treef71d01db031a0749cf5a54a5f8b967fdf4e4bebb
parentac5deb155d10b4f68b361172ff21808e8103f903
Fix portSWITCH_TO_USER_MODE() on Armv7-M MPU ports (#803)

A task's privilege level is stored in ulTaskFlag member in the TCB. Current
implementation of portSWITCH_TO_USER_MODE() does not update this
flag but just lowers the processor's privilege level. This results in many
APIs incorrectly determining task's privilege level and access permissions -

- xPortIsAuthorizedToAccessBuffer
- xPortIsTaskPrivileged
- xPortIsAuthorizedToAccessKernelObject

This PR fixes the portSWITCH_TO_USER_MODE() implementation to correctly
update the ulTaskFlag member in the TCB before lowering the processor's
privilege level.
portable/GCC/ARM_CM3_MPU/port.c
portable/GCC/ARM_CM3_MPU/portmacro.h
portable/GCC/ARM_CM4_MPU/port.c
portable/GCC/ARM_CM4_MPU/portmacro.h
portable/IAR/ARM_CM4F_MPU/port.c
portable/IAR/ARM_CM4F_MPU/portmacro.h
portable/RVDS/ARM_CM4_MPU/port.c
portable/RVDS/ARM_CM4_MPU/portmacro.h