-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapped*Guard objects should only be Send when the contained type is #258
Comments
In the case of |
Hmm yeah for the read guard, since there can be multiple instances and we're exposing a Which is, as you said, |
When using Sendable guard objects, such as with the
send_guard
feature or the locks in the spin crate, it is possible to get non-Sendable types across threads using theMapped*Guard
(MappedMutexGuard
,MappedRwLockReadGuard
,MappedRwLockWriteGuard
) objects.Currently, they're marked as
Send
as long as the raw lock isSend
with no bound onT
:parking_lot/lock_api/src/mutex.rs
Lines 604 to 607 in 5ac2971
This should probably have a
T: Send
bound, just like the regularMutexGuard
does. (Issue found by @sslab-gatech's Rust group)Here's a proof-of-concept compiled with
using this issue to cause a data-race with a
Cell
objectThis outputs:
The text was updated successfully, but these errors were encountered: