Skip to content

Commit a455b86

Browse files
authored
Add removed unprivileged access check to ARM_CRx_MPU xPortIsAuthorizedToAccessBuffer() (#1016)
* Add in a removed check for if a task is attempting to read a variable from a location it has write access to in xPortIsAuthorizedToAccessBuffer. * Add in a portDONT_DISCARD symbol as well.
1 parent 345a86d commit a455b86

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

portable/GCC/ARM_CRx_MPU/port.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,9 @@ static BaseType_t prvMPURegionAuthorizesBuffer( const xMPU_REGION_REGISTERS * xT
598598
if( ulAccessRequested == tskMPU_READ_PERMISSION ) /* RO. */
599599
{
600600
if( ( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RW_USER_RO ) ||
601-
( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RO_USER_RO ) )
601+
( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RO_USER_RO ) ||
602+
( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RW_USER_RW ) )
603+
602604
{
603605
xAccessGranted = pdTRUE;
604606
}

portable/GCC/ARM_CRx_MPU/portmacro.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ typedef uint32_t TickType_t;
221221
*/
222222
#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )
223223

224+
/**
225+
* @brief Ensure a symbol isn't removed from the compilation unit.
226+
*
227+
* @ingroup Port Interface Specifications
228+
*/
229+
#define portDONT_DISCARD __attribute__( ( used ) )
230+
224231
/**
225232
* @brief Defines if the tick count can be accessed atomically.
226233
*

0 commit comments

Comments
 (0)