diff --git a/event_groups.c b/event_groups.c index c69b96557..cb74464cf 100644 --- a/event_groups.c +++ b/event_groups.c @@ -693,6 +693,12 @@ } #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ + #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + vvMPU_ObjectDeleted( ( int32_t ) xEventGroup ); + } + #endif + traceRETURN_vEventGroupDelete(); } /*-----------------------------------------------------------*/ diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h index f5411fdd6..55effbee5 100644 --- a/include/FreeRTOS.h +++ b/include/FreeRTOS.h @@ -85,6 +85,12 @@ #define configENABLE_ACCESS_CONTROL_LIST 0 #endif +/* Set configENABLE_AUTOMATIC_ACL_CLEANUP to 1 to automatically revoke ACL + * permissions on object deletion. */ +#ifndef configENABLE_AUTOMATIC_ACL_CLEANUP + #define configENABLE_AUTOMATIC_ACL_CLEANUP 0 +#endif + /* Set default value of configNUMBER_OF_CORES to 1 to use single core FreeRTOS. */ #ifndef configNUMBER_OF_CORES #define configNUMBER_OF_CORES 1 diff --git a/include/mpu_wrappers.h b/include/mpu_wrappers.h index 69e6cbb40..dbb97bf71 100644 --- a/include/mpu_wrappers.h +++ b/include/mpu_wrappers.h @@ -278,6 +278,11 @@ #endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */ + + #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + void vvMPU_ObjectDeleted( int32_t lExternalKernelObjectHandle ) PRIVILEGED_FUNCTION; + #endif + #endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */ #define PRIVILEGED_FUNCTION __attribute__( ( section( "privileged_functions" ) ) ) diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index 612cbae18..d12737bcb 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -47,6 +47,21 @@ #include "mpu_syscall_numbers.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE + +void vvMPU_ObjectDeleted( int32_t lExternalKernelObjectHandle ) /* PRIVILEGED_FUNCTION */ +{ + if( IS_EXTERNAL_INDEX_VALID( lExternalKernelObjectHandle ) != pdFALSE ) + { + #if ( configENABLE_AUTOMATIC_ACL_CLEANUP == 1 ) + { + vRevokeAccessToKernelObject( NULL, lExternalKernelObjectHandle ); + } + #endif + + MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lExternalKernelObjectHandle ) ); + } +} + /*-----------------------------------------------------------*/ #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/queue.c b/queue.c index 41ef8ef91..c35d72752 100644 --- a/queue.c +++ b/queue.c @@ -2298,6 +2298,18 @@ void vQueueDelete( QueueHandle_t xQueue ) } #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ + #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + vvMPU_ObjectDeleted( ( int32_t ) xQueue ); + } + #endif + + #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + vvMPU_ObjectDeleted( ( int32_t ) xQueue ); + } + #endif + traceRETURN_vQueueDelete(); } /*-----------------------------------------------------------*/ diff --git a/stream_buffer.c b/stream_buffer.c index 57ac1be06..9f39d8ae1 100644 --- a/stream_buffer.c +++ b/stream_buffer.c @@ -596,6 +596,12 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) ( void ) memset( pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) ); } + #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) + { + vvMPU_ObjectDeleted( ( int32_t ) xStreamBuffer ); + } + #endif + traceRETURN_vStreamBufferDelete(); } /*-----------------------------------------------------------*/