Skip to content

Commit

Permalink
Add removed unprivileged access check to ARM_CRx_MPU xPortIsAuthorize…
Browse files Browse the repository at this point in the history
…dToAccessBuffer() (FreeRTOS#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.
  • Loading branch information
Skptak authored Mar 27, 2024
1 parent 345a86d commit a455b86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion portable/GCC/ARM_CRx_MPU/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,9 @@ static BaseType_t prvMPURegionAuthorizesBuffer( const xMPU_REGION_REGISTERS * xT
if( ulAccessRequested == tskMPU_READ_PERMISSION ) /* RO. */
{
if( ( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RW_USER_RO ) ||
( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RO_USER_RO ) )
( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RO_USER_RO ) ||
( ulMPURegionAccessPermissions == portMPU_REGION_PRIV_RW_USER_RW ) )

{
xAccessGranted = pdTRUE;
}
Expand Down
7 changes: 7 additions & 0 deletions portable/GCC/ARM_CRx_MPU/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ typedef uint32_t TickType_t;
*/
#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )

/**
* @brief Ensure a symbol isn't removed from the compilation unit.
*
* @ingroup Port Interface Specifications
*/
#define portDONT_DISCARD __attribute__( ( used ) )

/**
* @brief Defines if the tick count can be accessed atomically.
*
Expand Down

0 comments on commit a455b86

Please sign in to comment.