mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-07-10 13:29:45 -04:00
Remove ACL permissions for deleted resource
Setting the configENABLE_ACL_OBJECT_DELETION_CLEANUP flag will revoke ACL permissions across all tasks. Previously the task deleting the object would need to also revoke permissions.
This commit is contained in:
parent
d877cd5398
commit
f297bc194d
2 changed files with 256 additions and 187 deletions
|
|
@ -502,6 +502,13 @@
|
|||
* 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. *******/
|
||||
/******************************************************************************/
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@
|
|||
#define MPU_GetIndexForTaskHandle( xHandle ) MPU_GetIndexForHandle( ( OpaqueObjectHandle_t ) ( xHandle ), KERNEL_OBJECT_TYPE_TASK )
|
||||
|
||||
#if ( configUSE_EVENT_GROUPS == 1 )
|
||||
|
||||
/*
|
||||
* Wrappers to keep all the casting in one place for Event Group APIs.
|
||||
*/
|
||||
|
|
@ -226,16 +227,18 @@
|
|||
#endif /* #if ( configUSE_EVENT_GROUPS == 1 ) */
|
||||
|
||||
#if ( configUSE_STREAM_BUFFERS == 1 )
|
||||
|
||||
/*
|
||||
* Wrappers to keep all the casting in one place for Stream Buffer APIs.
|
||||
*/
|
||||
#define MPU_StoreStreamBufferHandleAtIndex( lIndex, xHandle ) MPU_StoreHandleAndDataAtIndex( ( lIndex ), ( OpaqueObjectHandle_t ) ( xHandle), NULL, KERNEL_OBJECT_TYPE_STREAM_BUFFER )
|
||||
#define MPU_StoreStreamBufferHandleAtIndex( lIndex, xHandle ) MPU_StoreHandleAndDataAtIndex( ( lIndex ), ( OpaqueObjectHandle_t ) ( xHandle ), NULL, KERNEL_OBJECT_TYPE_STREAM_BUFFER )
|
||||
#define MPU_GetStreamBufferHandleAtIndex( lIndex ) ( StreamBufferHandle_t ) MPU_GetHandleAtIndex( ( lIndex ), KERNEL_OBJECT_TYPE_STREAM_BUFFER )
|
||||
#define MPU_GetIndexForStreamBufferHandle( xHandle ) MPU_GetIndexForHandle( ( OpaqueObjectHandle_t ) ( xHandle ), KERNEL_OBJECT_TYPE_STREAM_BUFFER )
|
||||
|
||||
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
|
||||
|
||||
#if ( configUSE_TIMERS == 1 )
|
||||
|
||||
/*
|
||||
* Wrappers to keep all the casting in one place for Timer APIs.
|
||||
*/
|
||||
|
|
@ -343,6 +346,34 @@
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
|
||||
|
||||
static void vRevokeAccessObjectDeleted( int32_t lExternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */
|
||||
{
|
||||
int32_t i;
|
||||
TaskHandle_t xInternalTaskHandle;
|
||||
|
||||
if( IS_EXTERNAL_INDEX_VALID( lExternalIndexOfKernelObject ) != pdFALSE )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
vPortRevokeAccessToKernelObject( xInternalTaskHandle,
|
||||
CONVERT_TO_INTERNAL_INDEX( lExternalIndexOfKernelObject ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
|
||||
|
||||
void vGrantAccessToKernelObject( TaskHandle_t xExternalTaskHandle,
|
||||
|
|
@ -1648,6 +1679,12 @@
|
|||
|
||||
if( lIndex != -1 )
|
||||
{
|
||||
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
|
||||
{
|
||||
vRevokeAccessObjectDeleted( CONVERT_TO_EXTERNAL_INDEX( lIndex ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
MPU_SetIndexFreeInKernelObjectPool( lIndex );
|
||||
}
|
||||
|
||||
|
|
@ -1663,6 +1700,12 @@
|
|||
|
||||
if( xInternalTaskHandle != NULL )
|
||||
{
|
||||
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
|
||||
{
|
||||
vRevokeAccessObjectDeleted( lIndex );
|
||||
}
|
||||
#endif
|
||||
|
||||
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
|
||||
vTaskDelete( xInternalTaskHandle );
|
||||
}
|
||||
|
|
@ -2760,6 +2803,13 @@
|
|||
if( xInternalQueueHandle != NULL )
|
||||
{
|
||||
vQueueDelete( xInternalQueueHandle );
|
||||
|
||||
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
|
||||
{
|
||||
vRevokeAccessObjectDeleted( lIndex );
|
||||
}
|
||||
#endif
|
||||
|
||||
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -4247,6 +4297,13 @@
|
|||
if( xInternalEventGroupHandle != NULL )
|
||||
{
|
||||
vEventGroupDelete( xInternalEventGroupHandle );
|
||||
|
||||
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
|
||||
{
|
||||
vRevokeAccessObjectDeleted( lIndex );
|
||||
}
|
||||
#endif
|
||||
|
||||
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -4810,6 +4867,12 @@
|
|||
if( xInternalStreamBufferHandle != NULL )
|
||||
{
|
||||
vStreamBufferDelete( xInternalStreamBufferHandle );
|
||||
|
||||
#if ( ( configENABLE_ACCESS_CONTROL_LIST == 1 ) && ( configENABLE_ACL_OBJECT_DELETION_CLEANUP == 1 ) )
|
||||
{
|
||||
vRevokeAccessObjectDeleted( lIndex );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
|
||||
|
|
@ -5229,7 +5292,7 @@
|
|||
( UBaseType_t ) MPU_uxTimerGetReloadModeImpl, /* SYSTEM_CALL_uxTimerGetReloadMode. */
|
||||
( UBaseType_t ) MPU_xTimerGetPeriodImpl, /* SYSTEM_CALL_xTimerGetPeriod. */
|
||||
( UBaseType_t ) MPU_xTimerGetExpiryTimeImpl, /* SYSTEM_CALL_xTimerGetExpiryTime. */
|
||||
#else
|
||||
#else /* if ( configUSE_TIMERS == 1 ) */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_pvTimerGetTimerID. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_vTimerSetTimerID. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerIsTimerActive. */
|
||||
|
|
@ -5240,7 +5303,7 @@
|
|||
( UBaseType_t ) 0, /* SYSTEM_CALL_uxTimerGetReloadMode. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGetPeriod. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xTimerGetExpiryTime. */
|
||||
#endif
|
||||
#endif /* if ( configUSE_TIMERS == 1 ) */
|
||||
|
||||
#if ( configUSE_EVENT_GROUPS == 1 )
|
||||
( UBaseType_t ) MPU_xEventGroupClearBitsImpl, /* SYSTEM_CALL_xEventGroupClearBits. */
|
||||
|
|
@ -5254,13 +5317,13 @@
|
|||
( UBaseType_t ) 0, /* SYSTEM_CALL_uxEventGroupGetNumber. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_vEventGroupSetNumber. */
|
||||
#endif
|
||||
#else
|
||||
#else /* if ( configUSE_EVENT_GROUPS == 1 ) */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xEventGroupClearBits. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xEventGroupSetBits. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xEventGroupSync. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_uxEventGroupGetNumber. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_vEventGroupSetNumber. */
|
||||
#endif
|
||||
#endif /* if ( configUSE_EVENT_GROUPS == 1 ) */
|
||||
|
||||
#if ( configUSE_STREAM_BUFFERS == 1 )
|
||||
( UBaseType_t ) MPU_xStreamBufferSendImpl, /* SYSTEM_CALL_xStreamBufferSend. */
|
||||
|
|
@ -5280,8 +5343,7 @@
|
|||
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferBytesAvailable. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferSetTriggerLevel. */
|
||||
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferNextMessageLengthBytes. */
|
||||
#endif
|
||||
|
||||
#endif /* if ( configUSE_STREAM_BUFFERS == 1 ) */
|
||||
};
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue