-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
un-finished TA invocation will not be automatically canceled after invoker process exit #4781
Comments
Hi @zhaoxuyang13, Two things:
|
Thanks for your quick reply, @jforissier .
|
@jforissier after make and install, run ca.
|
@zhaoxuyang13 thanks for the test case, very helpful. I understand the issue better now.
Here is a patch against you test cases to make it work as expected. diff --git a/host/main.c b/host/main.c
index 119d487..b129964 100644
--- a/host/main.c
+++ b/host/main.c
@@ -42,11 +42,12 @@ void intHandler(int dummy) {
exit(0);
}
+TEEC_Operation op;
+
void *call_ta(void *arg){
TEEC_Result res;
TEEC_Context ctx;
TEEC_Session sess;
- TEEC_Operation op;
TEEC_UUID uuid = TA_HELLO_WORLD_UUID;
uint32_t err_origin;
@@ -119,6 +120,8 @@ int main(void)
pthread_detach(thread_id); // 线程分离,结束时自动回收资源
printf("sleep 3\n");
sleep(3);
+ printf("TEEC_RequestCancellation()\n");
+ TEEC_RequestCancellation(&op);
printf("exited\n");
return 0;
}
diff --git a/ta/hello_world_ta.c b/ta/hello_world_ta.c
index b91eecf..086165f 100644
--- a/ta/hello_world_ta.c
+++ b/ta/hello_world_ta.c
@@ -130,8 +130,11 @@ static TEE_Result dec_value(uint32_t param_types,
IMSG("Got value: %u from NW", params[0].value.a);
params[0].value.a--;
IMSG("Decrease value to: %u", params[0].value.a);
+ TEE_UnmaskCancellation();
while(true){
- ;
+ printf("wait\n");
+ if (TEE_Wait(1000) == TEE_ERROR_CANCEL)
+ return;
}
return TEE_SUCCESS;
} |
Many thanks for you answer. |
ahh, may I ask one more question? |
This behavior is not specified in the GP spec but in practice (OP-TEE implementation) it will sometime yield, but not always, because Perhaps we should change the code in |
I agree |
This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time. |
I have a CA and a TA,
I wonder if this is a problem ?
The text was updated successfully, but these errors were encountered: