Stop interrupt thread before destroying the enclave when error

This commit is contained in:
Hui, Chunyang 2022-06-22 10:45:21 +00:00 committed by volcano
parent f704604e36
commit 5d75584e32
2 changed files with 7 additions and 2 deletions

@ -161,7 +161,7 @@ int occlum_pal_exec(struct occlum_pal_exec_args *args);
int occlum_pal_kill(int pid, int sig);
/*
* @brief Destroy teh Occlum enclave
* @brief Destroy the Occlum enclave
*
* @retval if 0, then success; otherwise, check errno for the exact error type.
*/

@ -148,10 +148,15 @@ int occlum_pal_init(const struct occlum_pal_attr *attr) {
if (pal_run_init_process() < 0) {
PAL_ERROR("Failed to run the init process: %s", errno2str(errno));
goto on_destroy_enclave;
goto stop_interrupt_thread;
}
return 0;
stop_interrupt_thread:
if (pal_interrupt_thread_stop() < 0) {
PAL_WARN("Cannot stop the interrupt thread: %s", errno2str(errno));
}
on_destroy_enclave:
if (pal_destroy_enclave() < 0) {
PAL_WARN("Cannot destroy the enclave");