-
Notifications
You must be signed in to change notification settings - Fork 734
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 ManuallyDrop instead of mem::forget #2765
Conversation
uh oh. i'm headed to the airport for a vacation, but I started the CI for this. i'm guessing Miri would've caught this? |
no idea! |
The current code is UB and LLVM could choose to reuse the stack slot causing a UAF. ## Motivation UB is bad. ## Solution Don't do that.
# 0.1.40 This release fixes a potential stack use-after-free in the `Instrument::into_inner` method. Only uses of this method are affected by this bug. ### Fixed - Use `mem::ManuallyDrop` instead of `mem::forget` in `Instrument::into_inner` (#2765) [#2765]: #2765 Thanks to @cramertj and @Manishearth for finding and fixing this issue!
Wait, this is weird...that |
Gotta love functions that include a Safety section which aren't marked as |
The current code is UB and LLVM could choose to reuse the stack slot causing a UAF. ## Motivation UB is bad. ## Solution Don't do that.
# 0.1.40 This release fixes a potential stack use-after-free in the `Instrument::into_inner` method. Only uses of this method are affected by this bug. ### Fixed - Use `mem::ManuallyDrop` instead of `mem::forget` in `Instrument::into_inner` (tokio-rs#2765) [tokio-rs#2765]: tokio-rs#2765 Thanks to @cramertj and @Manishearth for finding and fixing this issue!
The current code is UB and LLVM could choose to reuse the stack slot causing a UAF.
Motivation
UB is bad.
Solution
Don't do that.