-
Notifications
You must be signed in to change notification settings - Fork 11
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
Box is unsound #10
Comments
Thank you for reporting this. Can you provide an example that will cause UB with I guess the fix is adding |
The current |
My memory is hazy wrt details (it was 6 years ago), but I'm rather sure that I've ended up with cases where the borrow checker would allow things leading to UAFs when I wrote the initial Box in the allocator-api crate without a PhantomData, and that was without may_dangle because it's never been stable. OTOH, I can't reproduce with trivial test cases with the rustc version of the time (1.25.0, which is the first version with NonNull in libstd). That said, I'd rather be overly cautious than not enough. |
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729 UltraBlame original commit: 3521a2abcbfb3b8f213770d8595af015f75f439c
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729 UltraBlame original commit: 3521a2abcbfb3b8f213770d8595af015f75f439c
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729
…hain-reviewers See also zakarumych/allocator-api2#10 This patch was produced with the following steps: - Vendor allocator-api2 normally. - Modify the vendored source in third_party/rust. - Stop exporting the Box implementation. - Change the version to 0.2.999. - Run cargo update -p allocator-api2 --precise 0.2.999 Differential Revision: https://phabricator.services.mozilla.com/D218729
allocator-api2's Box is backed by a NonNull.
std's Box is backed by a Unique. Unique is a wrapper around NonNull with an important addition: a marker to give a hint to dropck
The Box type in this crate doesn't have this marker.
Relatedly, I'm working on refreshing https://crates.io/crates/allocator-api with code automatically generated from the code in the rust repo (and comparing what I have vs this crate is how I found this discrepancy).
The text was updated successfully, but these errors were encountered: