Skip to content

Commit 6354b9a

Browse files
author
Michael Schwarcz
committed
TF-M patch: More fixes to tfm_memory_check issue (TF-M issue #224)
- Link to bug tracking: https://developer.trustedfirmware.org/T224
1 parent d030c04 commit 6354b9a

File tree

1 file changed

+14
-0
lines changed
  • components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc

1 file changed

+14
-0
lines changed

components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ REGION_DECLARE_EXT(Image$$, ARM_LIB_HEAP, $$ZI$$Base);
470470
REGION_DECLARE_EXT(Image$$, ARM_LIB_HEAP, $$ZI$$Limit);
471471
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$Base);
472472
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$Limit);
473+
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Base);
474+
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Limit);
473475
REGION_DECLARE_EXT(Image$$, TFM_SECURE_STACK, $$ZI$$Base);
474476
REGION_DECLARE_EXT(Image$$, TFM_SECURE_STACK, $$ZI$$Limit);
475477
REGION_DECLARE_EXT(Image$$, TFM_UNPRIV_SCRATCH, $$ZI$$Base);
@@ -534,6 +536,12 @@ int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller)
534536
return IPC_SUCCESS;
535537
}
536538

539+
base = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$ZI$$Base);
540+
limit = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$ZI$$Limit);
541+
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
542+
return IPC_SUCCESS;
543+
}
544+
537545
base = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$Base);
538546
limit = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$Limit);
539547
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
@@ -552,6 +560,12 @@ int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller)
552560
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
553561
return IPC_SUCCESS;
554562
}
563+
564+
base = (uintptr_t)S_CODE_START;
565+
limit = (uintptr_t)(S_CODE_START + S_CODE_SIZE);
566+
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
567+
return IPC_SUCCESS;
568+
}
555569
}
556570

557571
return IPC_ERROR_MEMORY_CHECK;

0 commit comments

Comments
 (0)