Skip to content

Commit 865373a

Browse files
author
Arash Sahebolamri
committed
Do not let tokio swallow forwarded panics
1 parent 68aa759 commit 865373a

File tree

1 file changed

+8
-4
lines changed
  • intel-sgx/enclave-runner/src/usercalls

1 file changed

+8
-4
lines changed

intel-sgx/enclave-runner/src/usercalls/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,9 +855,6 @@ impl EnclaveState {
855855
EnclavePanic::DebugStr("async exit with a panic".to_owned())
856856
}
857857
};
858-
if enclave.forward_panics {
859-
panic!("{}", &panic);
860-
}
861858
Err(EnclaveAbort::Exit{ panic: Some(panic) })
862859
}
863860
Err(EnclaveAbort::Exit { panic: false }) => Err(EnclaveAbort::Exit{ panic: None }),
@@ -1093,10 +1090,17 @@ impl EnclaveState {
10931090
let main_result =
10941091
EnclaveState::syscall_loop(enclave.clone(), io_queue_receive, io_queue_send, work_sender);
10951092

1093+
if let Err(EnclaveAbort::Exit { panic: Some(panic) }) = &main_result {
1094+
if enclave.forward_panics {
1095+
panic!("{}", panic);
1096+
}
1097+
}
1098+
10961099
for handler in join_handlers {
10971100
let _ = handler.join();
10981101
}
1099-
return main_result;
1102+
1103+
main_result
11001104
}
11011105

11021106
pub(crate) fn main_entry(

0 commit comments

Comments
 (0)