-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi there, we (Rust group @sslab-gatech) are scanning crates on crates.io for potential soundness bugs. We noticed that SharedMutex implements Send and Sync so long as the contained type is Sync:
Lines 37 to 38 in f289000
| unsafe impl<T: ?Sized + Send> Send for SharedMutex<T> {} | |
| unsafe impl<T: ?Sized + Sync> Sync for SharedMutex<T> {} |
However, this should be Send + Sync bound just like the standard library's Mutex requires Send. There are some types such as MutexGuard which are safe to use across threads but can't be sent (in the case of MutexGuard this is because it's undefined behavior to acquire and free a lock from a different thread). There's more examples here: https://users.rust-lang.org/t/sync-but-not-send/21551
Metadata
Metadata
Assignees
Labels
No labels