mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-11-05 19:22:31 -05:00
armv8.1-m: Add task dedicated PAC key
To harden the security, each task is assigned a dedicated PAC key, so that attackers needs to guess the all the tasks' PAC keys right to exploit the system using Return Oriented Programming. The kernel is now updated to support the following: * A PAC key set with a random number generated and is pushed onto the task's stack when a task is created. * As part of scheduling, the task's PAC key is stacked/unstacked to/from the task's stack when a task is unscheduled/scheduled from/to run. Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com>
This commit is contained in:
parent
c84fc7226e
commit
029545f4ad
63 changed files with 4247 additions and 1292 deletions
|
|
@ -1582,6 +1582,20 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
|||
}
|
||||
#endif /* configUSE_MPU_WRAPPERS_V1 == 0 */
|
||||
|
||||
#if ( configENABLE_PAC == 1 )
|
||||
{
|
||||
uint32_t ulTaskPacKey[ 4 ], i;
|
||||
|
||||
vApplicationGenerateTaskRandomPacKey( &( ulTaskPacKey[ 0 ] ) );
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
xMPUSettings->ulContext[ ulIndex ] = ulTaskPacKey[ i ];
|
||||
ulIndex++;
|
||||
}
|
||||
}
|
||||
#endif /* configENABLE_PAC */
|
||||
|
||||
return &( xMPUSettings->ulContext[ ulIndex ] );
|
||||
}
|
||||
|
||||
|
|
@ -1664,6 +1678,20 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
|
|||
}
|
||||
#endif /* portPRELOAD_REGISTERS */
|
||||
|
||||
#if ( configENABLE_PAC == 1 )
|
||||
{
|
||||
uint32_t ulTaskPacKey[ 4 ], i;
|
||||
|
||||
vApplicationGenerateTaskRandomPacKey( &( ulTaskPacKey[ 0 ] ) );
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ulTaskPacKey[ i ];
|
||||
}
|
||||
}
|
||||
#endif /* configENABLE_PAC */
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue