From 04be187d94517429ce11eb063f16421e861dedc1 Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Fri, 16 Feb 2024 10:08:24 +0100 Subject: [PATCH] core: reset cancellation mask on TA exit Before this patch, the TA cancellation mask was only reset when the session was created, but the GP spec requires the cancellation mask to be reset each time a TA is entered via one of its entry points. So fix this by resetting the cancellation mask each time a TA returns. Link: https://github.com/OP-TEE/optee_test/issues/731 Fixes: b01047730e77 ("Open-source the TEE Core") Signed-off-by: Jens Wiklander Acked-by: Etienne Carriere Reviewed-by: Jerome Forissier --- core/kernel/user_ta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/kernel/user_ta.c b/core/kernel/user_ta.c index 1e2663378b6..cba8de3283e 100644 --- a/core/kernel/user_ta.c +++ b/core/kernel/user_ta.c @@ -223,11 +223,12 @@ static TEE_Result user_ta_enter(struct ts_session *session, dec_recursion(); out_clr_cancel: /* - * Clear the cancel state now that the user TA has returned. The next + * Reset the cancel state now that the user TA has returned. The next * time the TA will be invoked will be with a new operation and should * not have an old cancellation pending. */ ta_sess->cancel = false; + ta_sess->cancel_mask = true; return res; }