mirror of https://github.com/ARMmbed/mbed-os.git
TF-M patch: Fix tfm_memory_check issue (TF-M issue #224)
- Add Secure/non-secure code and secure heap to memory check - Link to bug tracking: https://developer.trustedfirmware.org/T224pull/9915/head
parent
749faa6534
commit
7a2c7d7df4
|
@ -466,6 +466,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);
|
||||
|
@ -521,7 +523,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) {
|
||||
|
@ -546,6 +560,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;
|
||||
|
|
Loading…
Reference in New Issue