-
Couldn't load subscription status.
- Fork 13.9k
Description
A lot of code dealing with synchronization assumes that thread::park does not panic. This assumption is however not correct. For instance, a panic occurs if the TLS key used to store the thread info cannot be created, if a new thread id cannot be created, if the creation of a parking primitive fails, if the current time is not available and if the parking operation fails.
The code examples above all use intrusive lists and have to wait on a condition to before destroying the list nodes. If thread::park panics, the nodes will be dropped during stack unwinding without checking that condition, leading to undefined behaviour (some of these cases are in std, so I'm marking this as a soundness problem with std).
Fixing this would either require guarding against panics in each of these cases or ensuring that thread::park never panics.
@rustbot label +I-unsound +A-atomic +T-libs +T-libs-api