Test: Memory check interface update
Updated the 'tfm_hal_memory_check' because of interface update.
This API is not designed for partition usage, hence the solution is
fragile. Temporary disable related test case till an update is decided.
Signed-off-by: Summer Qin <summer.qin@arm.com>
Change-Id: I4c65cc64bbff393c902a561d73bd6a07338f86ba
diff --git a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/CMakeLists.txt b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/CMakeLists.txt
index d3552ba..2549f6e 100644
--- a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/CMakeLists.txt
+++ b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/CMakeLists.txt
@@ -69,5 +69,4 @@
target_compile_definitions(tfm_partition_defs
INTERFACE
TFM_PARTITION_TEST_CORE_IPC
- $<$<AND:$<BOOL:${TEST_S_IPC}>,$<VERSION_EQUAL:${TFM_ISOLATION_LEVEL},3>>:TFM_IPC_ISOLATION_3_RETRIEVE_APP_MEM>
)
diff --git a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/tfm_ipc_client_test.c b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/tfm_ipc_client_test.c
index ad2e977..ca04de3 100644
--- a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/tfm_ipc_client_test.c
+++ b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_client/tfm_ipc_client_test.c
@@ -155,11 +155,16 @@
#endif
#ifdef TFM_IPC_ISOLATION_3_RETRIEVE_APP_MEM
+/*
+ * Fixme: Temporarily using a predefined boundary value.
+ * will replace it later.
+ */
+#define AROT_BOUNDARY 0
+
static int ipc_client_retrieve_app_mem_test(void)
{
psa_handle_t handle;
psa_status_t status;
- uint32_t attr = 0;
uint8_t *outvec_data[1] = {0};
struct psa_outvec outvecs[1] = {{outvec_data, sizeof(outvec_data[0])}};
@@ -180,10 +185,8 @@
*/
uint8_t *psa_data_p = outvec_data[0];
if (psa_data_p) {
- attr |= (TFM_HAL_ACCESS_READABLE | TFM_HAL_ACCESS_WRITABLE
- | TFM_HAL_ACCESS_UNPRIVILEGED);
- if (tfm_hal_memory_has_access((uintptr_t)psa_data_p, 1, attr) ==
- TFM_HAL_ERROR_MEM_FAULT) {
+ if (tfm_hal_memory_check(AROT_BOUNDARY, (uintptr_t)psa_data_p, 1,
+ TFM_HAL_ACCESS_READWRITE) == TFM_HAL_ERROR_MEM_FAULT) {
return IPC_SP_TEST_SUCCESS;
} else {
return IPC_SP_TEST_FAILED;
diff --git a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/CMakeLists.txt b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/CMakeLists.txt
index 54e1252..eaade9b 100644
--- a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/CMakeLists.txt
+++ b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/CMakeLists.txt
@@ -73,5 +73,4 @@
target_compile_definitions(tfm_partition_defs
INTERFACE
TFM_PARTITION_TEST_CORE_IPC
- $<$<VERSION_GREATER:${TFM_ISOLATION_LEVEL},1>:TFM_IPC_ISOLATION_2_TEST_READ_ONLY_MEM>
)
diff --git a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c
index 9409063..3fc7537 100644
--- a/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c
+++ b/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c
@@ -100,11 +100,17 @@
}
#ifdef TFM_IPC_ISOLATION_2_TEST_READ_ONLY_MEM
+/*
+ * Fixme: Temporarily using a predefined boundary value.
+ * will replace it later.
+ */
+#define PROT_BOUNDARY 2
+
static void ipc_service_psa_access_app_readonly_mem(void)
{
psa_msg_t msg;
char rec_data;
- uint32_t rec_buf, attr = 0;
+ uint32_t rec_buf;
psa_get(IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL, &msg);
switch (msg.type) {
@@ -126,10 +132,8 @@
psa_reply(msg.handle, -1);
break;
}
- attr |= (TFM_HAL_ACCESS_READABLE | TFM_HAL_ACCESS_WRITABLE
- | TFM_HAL_ACCESS_UNPRIVILEGED);
- if (tfm_hal_memory_has_access((uintptr_t)rec_buf, 4, attr) !=
- TFM_HAL_ERROR_MEM_FAULT) {
+ if (tfm_hal_memory_check(PROT_BOUNDARY, (uintptr_t)rec_buf, 4,
+ TFM_HAL_ACCESS_READWRITE) != TFM_HAL_ERROR_MEM_FAULT) {
psa_reply(msg.handle, PSA_ERROR_GENERIC_ERROR);
break;
}