Add advisory for unbounded-spsc: Sender::send transmute UAF under tx/rx race#2884
Closed
berkant-koc wants to merge 1 commit into
Closed
Conversation
…rx race The DISCONNECTED arm of Sender::send transmutes *mut Producer<T> as a value-level Consumer<T>, yielding OOB read inside the Sender frame and a fake-Arc drop on a non-allocated address. Reachable via TOCTOU race between Receiver::drop and Sender::send.
Member
|
Do you have approval from the maintainer to publish this? |
Contributor
Author
|
Same — closing per your point on #2883. The private channel here bounced ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resubmission of the unbounded-spsc half of #2882, split per @djc's review and trimmed.
Sender::send(single-file crate,src/lib.rs:379-405in 0.2.0 / commit23a9ce7) transmutes*mut Producer<T>(a pointer, 8 bytes on 64-bit) into the bytes of a value-levelConsumer<T>. The resultingConsumer::buffer.ptris the address of a field on theSender, not the realArcInner<Buffer<T>>.consumer.try_pop()then readsBuffer<T>offsets that lie inside theSender<T>frame (OOB), andDropfor the fake Arc callsdeallocon a non-allocated address.Branch is only reachable single-threaded if the receiver-drop /
connected = falseguard is bypassed; the trigger is a TOCTOU race betweenSender::send'sconnected.load()andReceiver::drop'scompare_exchange(_, DISCONNECTED, ...). The author's own test suite carries a TODO atsrc/lib.rs:975referencing the same assert that fires in the buggy path — the symptom was observed but misclassified.The companion
oneringbufadvisory is filed separately as a sibling PR.Closes prior #2882 (superseded by this + the oneringbuf PR).