Fallback to old way for exit process in simulation mode
This commit is contained in:
parent
45b799d99f
commit
4f96790cf3
@ -29,10 +29,12 @@ int occlum_pal_init(const struct occlum_pal_attr *attr) {
|
|||||||
errno = EEXIST;
|
errno = EEXIST;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
// FIXME
|
||||||
|
#ifndef SGX_MODE_SIM
|
||||||
if (pal_register_sig_handlers() < 0) {
|
if (pal_register_sig_handlers() < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pal_init_enclave(attr->instance_dir) < 0) {
|
if (pal_init_enclave(attr->instance_dir) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -53,10 +55,13 @@ int occlum_pal_init(const struct occlum_pal_attr *attr) {
|
|||||||
goto on_destroy_enclave;
|
goto on_destroy_enclave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
#ifndef SGX_MODE_SIM
|
||||||
if (pal_interrupt_thread_start() < 0) {
|
if (pal_interrupt_thread_start() < 0) {
|
||||||
PAL_ERROR("Failed to start the interrupt thread: %s", errno2str(errno));
|
PAL_ERROR("Failed to start the interrupt thread: %s", errno2str(errno));
|
||||||
goto on_destroy_enclave;
|
goto on_destroy_enclave;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
on_destroy_enclave:
|
on_destroy_enclave:
|
||||||
@ -168,10 +173,14 @@ int occlum_pal_destroy(void) {
|
|||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
#ifndef SGX_MODE_SIM
|
||||||
if (pal_interrupt_thread_stop() < 0) {
|
if (pal_interrupt_thread_stop() < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
PAL_WARN("Cannot stop the interrupt thread: %s", errno2str(errno));
|
PAL_WARN("Cannot stop the interrupt thread: %s", errno2str(errno));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pal_destroy_enclave() < 0) {
|
if (pal_destroy_enclave() < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
PAL_WARN("Cannot destroy the enclave");
|
PAL_WARN("Cannot destroy the enclave");
|
||||||
|
@ -130,8 +130,14 @@ int pal_init_enclave(const char *instance_dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int pal_destroy_enclave(void) {
|
int pal_destroy_enclave(void) {
|
||||||
|
// FIXME: Due to lack of support for enclave interrupt in simulation mode, some programs
|
||||||
|
// come across the problem that it can't exit when running in simulation mode. We have to
|
||||||
|
// fallback to the old way to exit brutely in simulation mode.
|
||||||
|
#ifndef SGX_MODE_SIM
|
||||||
sgx_destroy_enclave(global_eid);
|
sgx_destroy_enclave(global_eid);
|
||||||
global_eid = SGX_INVALID_ENCLAVE_ID;
|
global_eid = SGX_INVALID_ENCLAVE_ID;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user