aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Peng <kevin.peng@arm.com>2021-03-04 14:13:03 +0800
committerKen Liu <Ken.Liu@arm.com>2021-03-05 04:28:38 +0000
commite212ea1637a66255b44d0e7c19ebe9786ab56ccb (patch)
tree32ec148834849039107091d1912a7adedde7f28b
parent414523fa445019e92b443c0d30f1915e1e97db60 (diff)
downloadtrusted-firmware-m-e212ea1637a66255b44d0e7c19ebe9786ab56ccb.tar.gz
SPM: Prevent IPC SVC call from Handler Mode
As IPC SVC is expecting client call from Thread mode. Change-Id: Iab1e587d15c25e7685d19c7f35696d6731a014a7 Signed-off-by: Kevin Peng <kevin.peng@arm.com>
-rw-r--r--secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index cff1ee3dc3..c0b880fca6 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -129,6 +129,11 @@ uint32_t tfm_core_svc_handler(uint32_t *msp, uint32_t *psp, uint32_t exc_return)
tfm_svc_number_t svc_number = TFM_SVC_PSA_FRAMEWORK_VERSION;
uint32_t *svc_args = msp;
+ if (!(exc_return & EXC_RETURN_MODE)) {
+ /* Calling SVC from Handler Mode is not supported */
+ tfm_core_panic();
+ }
+
if ((exc_return & EXC_RETURN_MODE) && (exc_return & EXC_RETURN_SPSEL)) {
/* Use PSP when both EXC_RETURN.MODE and EXC_RETURN.SPSEL are set */
svc_args = psp;