mobilecoinfoundation / sgx-std

Rust libstd functionality for SGX enclaves

Home Page:https://mobilecoin.foundation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better synchronization poisoning

nick-mobilecoin opened this issue · comments

Currently the poisoning logic in rust std::sync relies on unwinding.
MutexGuard::drop() will call the drop() on the Mutexes poison flag.

The current panicking in SGX does not unwind which means the poisoning will never happen.
If we chose to utilize a global panic count for poisoning then all other [Mutex']es, not just the one held in the panicked thread, will report poisoned. This may be ok since the abort()` function used in the panic handler sets the enclave crashed flag, which means any threads still working will finish, but no new ones will start. This results in requiring an enclave reload.