-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use deref target in Pin trait implementations #67039
Use deref target in Pin trait implementations #67039
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Should we crater this? @bors try |
Use deref target in Pin trait implementations Using deref target instead of pointer itself avoids providing access to `&Rc<T>` for malicious implementations, which would allow calling `Rc::get_mut`. This is a breaking change necessary due to unsoundness, however the impact of it should be minimal. This only fixes the issue with malicious `PartialEq` implementations, other `Pin` soundness issues are still here. See <https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73> for more details.
☀️ Try build successful - checks-azure |
Seems good to me. I’d be interested to see crater results. |
This comment has been minimized.
This comment has been minimized.
It would be good to add UI tests to this PR so that we have checks ensuring that the problematic pattern this is meant to catch cannot happen in the future. |
8bee4ff
to
efaba2d
Compare
@Centril Added UI test. |
Using deref target instead of pointer itself avoids providing access to `&Rc<T>` for malicious implementations, which would allow calling `Rc::get_mut`. This is a breaking change necessary due to unsoundness, however the impact of it should be minimal. This only fixes the issue with malicious `PartialEq` implementations, other `Pin` soundness issues are still here. See <https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73> for more details.
efaba2d
to
6996ae1
Compare
Also, made amount of commits a bit smaller by merging some commits together. |
big +1. these implementations were just unsound and this is the correct way to implement these traits for these types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@bors r+ I'm going to go ahead and r+ this without a crater run. It seems quite unlikely that we'll see any regressions here, and this is a soundness fix. |
📌 Commit 61d9c00 has been approved by |
…akis Use deref target in Pin trait implementations Using deref target instead of pointer itself avoids providing access to `&Rc<T>` for malicious implementations, which would allow calling `Rc::get_mut`. This is a breaking change necessary due to unsoundness, however the impact of it should be minimal. This only fixes the issue with malicious `PartialEq` implementations, other `Pin` soundness issues are still here. See <https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73> for more details.
☀️ Test successful - checks-azure |
Using deref target instead of pointer itself avoids providing access to
&Rc<T>
for malicious implementations, which would allow callingRc::get_mut
.This is a breaking change necessary due to unsoundness, however the impact of it should be minimal.
This only fixes the issue with malicious
PartialEq
implementations, otherPin
soundness issues are still here.See https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73 for more details.