Skip ACL cleanup for a task deleting itself

This commit is contained in:
Kody Stribrny 2026-06-04 09:28:19 -07:00
parent f297bc194d
commit 7a84a836a6
2 changed files with 21 additions and 24 deletions

View file

@ -502,13 +502,6 @@
* provided for the same. Defaults to 0 if left undefined. */
#define configENABLE_ACCESS_CONTROL_LIST 1
/* When using the v2 MPU wrapper with Access Control Lists enabled, set
* configENABLE_ACL_OBJECT_DELETION_CLEANUP to 1 to automatically remove
* access permissions to the object upon deletion. If this is not enabled,
* the privileged task calling the deletion API has the responsibility to
* clean up the ACLs. */
#define configENABLE_ACL_OBJECT_DELETION_CLEANUP 0
/******************************************************************************/
/* SMP( Symmetric MultiProcessing ) Specific Configuration definitions. *******/
/******************************************************************************/

View file

@ -346,32 +346,36 @@
}
/*-----------------------------------------------------------*/
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
static void vRevokeAccessObjectDeleted( int32_t lExternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */
static void vRevokeAccessofDeletedObjectFromAllTasks( int32_t lExternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */
{
int32_t i;
int32_t lInternalIndexOfKernelObject;
TaskHandle_t xInternalTaskHandle;
if( IS_EXTERNAL_INDEX_VALID( lExternalIndexOfKernelObject ) != pdFALSE )
{
lInternalIndexOfKernelObject = ( int32_t ) CONVERT_TO_INTERNAL_INDEX( lExternalIndexOfKernelObject );
for( i = 0; i < configPROTECTED_KERNEL_OBJECT_POOL_SIZE; i++ )
{
if( xKernelObjectPool[ i ].ulKernelObjectType == KERNEL_OBJECT_TYPE_TASK )
{
xInternalTaskHandle = ( TaskHandle_t ) xKernelObjectPool[ i ].xInternalObjectHandle;
if( xInternalTaskHandle != NULL )
if( ( xInternalTaskHandle != NULL ) &&
( i != lInternalIndexOfKernelObject ) )
{
vPortRevokeAccessToKernelObject( xInternalTaskHandle,
CONVERT_TO_INTERNAL_INDEX( lExternalIndexOfKernelObject ) );
lInternalIndexOfKernelObject );
}
}
}
}
}
#endif /* #if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) ) */
#endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */
/*-----------------------------------------------------------*/
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
@ -1679,9 +1683,9 @@
if( lIndex != -1 )
{
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
{
vRevokeAccessObjectDeleted( CONVERT_TO_EXTERNAL_INDEX( lIndex ) );
vRevokeAccessofDeletedObjectFromAllTasks( CONVERT_TO_EXTERNAL_INDEX( lIndex ) );
}
#endif
@ -1700,9 +1704,9 @@
if( xInternalTaskHandle != NULL )
{
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
{
vRevokeAccessObjectDeleted( lIndex );
vRevokeAccessofDeletedObjectFromAllTasks( lIndex );
}
#endif
@ -2804,9 +2808,9 @@
{
vQueueDelete( xInternalQueueHandle );
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
{
vRevokeAccessObjectDeleted( lIndex );
vRevokeAccessofDeletedObjectFromAllTasks( lIndex );
}
#endif
@ -4298,9 +4302,9 @@
{
vEventGroupDelete( xInternalEventGroupHandle );
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
{
vRevokeAccessObjectDeleted( lIndex );
vRevokeAccessofDeletedObjectFromAllTasks( lIndex );
}
#endif
@ -4868,9 +4872,9 @@
{
vStreamBufferDelete( xInternalStreamBufferHandle );
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
{
vRevokeAccessObjectDeleted( lIndex );
vRevokeAccessofDeletedObjectFromAllTasks( lIndex );
}
#endif
}
@ -5292,7 +5296,7 @@
( UBaseType_t ) MPU_uxTimerGetReloadModeImpl, /* SYSTEM_CALL_uxTimerGetReloadMode. */
( UBaseType_t ) MPU_xTimerGetPeriodImpl, /* SYSTEM_CALL_xTimerGetPeriod. */
( UBaseType_t ) MPU_xTimerGetExpiryTimeImpl, /* SYSTEM_CALL_xTimerGetExpiryTime. */
#else /* if ( configUSE_TIMERS == 1 ) */
#else /* if ( configUSE_TIMERS == 1 ) */
( UBaseType_t ) 0, /* SYSTEM_CALL_pvTimerGetTimerID. */
( UBaseType_t ) 0, /* SYSTEM_CALL_vTimerSetTimerID. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerIsTimerActive. */
@ -5317,7 +5321,7 @@
( UBaseType_t ) 0, /* SYSTEM_CALL_uxEventGroupGetNumber. */
( UBaseType_t ) 0, /* SYSTEM_CALL_vEventGroupSetNumber. */
#endif
#else /* if ( configUSE_EVENT_GROUPS == 1 ) */
#else /* if ( configUSE_EVENT_GROUPS == 1 ) */
( UBaseType_t ) 0, /* SYSTEM_CALL_xEventGroupClearBits. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xEventGroupSetBits. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xEventGroupSync. */