diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c index f6c3697e64..d80c18348c 100644 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c @@ -463,6 +463,8 @@ static uint32_t tfm_spm_partition_get_priority_ext(uint32_t partition_idx) /* Macros to pick linker symbols and allow references to sections in all level*/ #define REGION_DECLARE_EXT(a, b, c) extern uint32_t REGION_NAME(a, b, c) +REGION_DECLARE_EXT(Image$$, ARM_LIB_HEAP, $$ZI$$Base); +REGION_DECLARE_EXT(Image$$, ARM_LIB_HEAP, $$ZI$$Limit); REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Base); REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Limit); REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$RW$$Base); @@ -518,7 +520,19 @@ int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller) if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { return IPC_SUCCESS; } + + base = (uintptr_t)NS_CODE_START; + limit = (uintptr_t)(NS_CODE_START + NS_CODE_SIZE); + if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { + return IPC_SUCCESS; + } } else { + base = (uintptr_t)®ION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Base); + limit = (uintptr_t)®ION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit); + if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { + return IPC_SUCCESS; + } + base = (uintptr_t)®ION_NAME(Image$$, ER_TFM_DATA, $$RW$$Base); limit = (uintptr_t)®ION_NAME(Image$$, ER_TFM_DATA, $$RW$$Limit); if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { @@ -543,6 +557,12 @@ int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller) if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { return IPC_SUCCESS; } + + base = (uintptr_t)S_CODE_START; + limit = (uintptr_t)(S_CODE_START + S_CODE_SIZE); + if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { + return IPC_SUCCESS; + } } return IPC_ERROR_MEMORY_CHECK;