SyncChannel<T> can move 'T: !Send' to other threads
High severity
GitHub Reviewed
Published
Aug 25, 2021
to the GitHub Advisory Database
•
Updated Jun 13, 2023
Description
Reviewed
Aug 6, 2021
Published to the GitHub Advisory Database
Aug 25, 2021
Last updated
Jun 13, 2023
Affected versions of this crate unconditionally implement Send/Sync for
SyncChannel<T>
.SyncChannel<T>
doesn't provide access to&T
but merely serves as a channel that consumes and returns ownedT
. Users can create UB in safe Rust by sendingT: !Send
to other threads withSyncChannel::send/recv
APIs. UsingT = Arc<Cell<_>
allows to create data races (which can lead to memory corruption), and usingT = MutexGuard<T>
allows to unlock a mutex from a thread that didn't lock the mutex.References