mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Make RAM regions non-executable
This commit makes the privileged RAM and stack regions non-executable. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
parent
ea9c26f524
commit
c2d616eaee
|
@ -662,6 +662,7 @@ static void prvSetupMPU( void )
|
||||||
|
|
||||||
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
||||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
|
||||||
|
@ -761,6 +762,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) |
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
|
||||||
|
@ -786,7 +788,8 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
( portSTACK_REGION ); /* Region number. */
|
( portSTACK_REGION ); /* Region number. */
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) | /* Read and write. */
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
|
|
@ -772,6 +772,7 @@ static void prvSetupMPU( void )
|
||||||
( portPRIVILEGED_RAM_REGION );
|
( portPRIVILEGED_RAM_REGION );
|
||||||
|
|
||||||
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
@ -883,6 +884,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) |
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
@ -909,7 +911,8 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
( portSTACK_REGION ); /* Region number. */
|
( portSTACK_REGION ); /* Region number. */
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) | /* Read and write. */
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
|
|
@ -591,6 +591,7 @@ static void prvSetupMPU( void )
|
||||||
( portPRIVILEGED_RAM_REGION );
|
( portPRIVILEGED_RAM_REGION );
|
||||||
|
|
||||||
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
@ -660,6 +661,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) |
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
@ -686,7 +688,8 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
( portSTACK_REGION ); /* Region number. */
|
( portSTACK_REGION ); /* Region number. */
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) | /* Read and write. */
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
|
|
@ -773,6 +773,7 @@ static void prvSetupMPU( void )
|
||||||
( portPRIVILEGED_RAM_REGION );
|
( portPRIVILEGED_RAM_REGION );
|
||||||
|
|
||||||
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
portMPU_REGION_ATTRIBUTE_REG = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
@ -872,6 +873,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) |
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
@ -898,7 +900,8 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
( portSTACK_REGION ); /* Region number. */
|
( portSTACK_REGION ); /* Region number. */
|
||||||
|
|
||||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||||
( portMPU_REGION_READ_WRITE ) | /* Read and write. */
|
( portMPU_REGION_READ_WRITE ) |
|
||||||
|
( portMPU_REGION_EXECUTE_NEVER ) |
|
||||||
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||||
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
( ( configTEX_S_C_B_SRAM & portMPU_RASR_TEX_S_C_B_MASK ) << portMPU_RASR_TEX_S_C_B_LOCATION ) |
|
||||||
( portMPU_REGION_ENABLE );
|
( portMPU_REGION_ENABLE );
|
||||||
|
|
Loading…
Reference in a new issue