Skip to content
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

sync: remove RwLockWriteGuard::map and RwLockWriteGuard::try_map #3345

Merged
merged 1 commit into from Dec 25, 2020

Conversation

Darksonn
Copy link
Contributor

@Darksonn Darksonn commented Dec 25, 2020

This PR fixes a soundness hole. This is a breaking change, but breaking changes are allowed under our semver policy when they are required to fix a soundness hole. (See this RFC for more).

Note that we have chosen not to do a deprecation cycle or similar because Tokio 1.0.0 was released two days ago, and therefore it should not impact many people.

Closes: #3344

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Dec 25, 2020
@Kestrer
Copy link
Contributor

Kestrer commented Dec 25, 2020

If we instead solve this soundness issue by changing the return type of map to something like MappedRwLockReadGuard we will be able to keep downgrade in the long term without having another breaking change, which might be better overall.

@Darksonn Darksonn changed the title sync: remove RwLockWriteGuard::downgrade sync: introduce mapped RwLock guard types Dec 25, 2020
@Darksonn
Copy link
Contributor Author

Darksonn commented Dec 25, 2020

We have decided to remove the map and try_map methods on RwLockWriteGuard, since this also fixes the soundness, and it would not be a breaking change to fix it later with this change.

We just don't have the review-bandwidth to do this in one go on the 25th of December.

@Darksonn Darksonn changed the title sync: introduce mapped RwLock guard types sync: remove RwLockWriteGuard::map and RwLockWriteGuard::try_map Dec 25, 2020
@Darksonn Darksonn merged commit fe2664a into master Dec 25, 2020
@Darksonn Darksonn deleted the remove-downgrade branch December 25, 2020 20:36
@carllerche carllerche added the I-unsound 💥 A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness label Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate I-unsound 💥 A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness M-sync Module: tokio/sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsoundness mapping/downgrading in RwLock
5 participants