-
-
Notifications
You must be signed in to change notification settings - Fork 6
SHM transport teardown may leave dangling SelfRef borrows into unmapped memory #232
Copy link
Copy link
Open
Description
Problem
When the shared memory transport is torn down (region unmapped), there may still be outstanding SelfRef backing that borrows from the shared memory region. If any code still holds a SelfRef pointing into the unmapped region, accessing it is use-after-unmap — unsoundness.
How it could happen
- A response arrives over the SHM transport
- The response payload is deserialized as a
SelfRef<T>borrowing from the SHM ring buffer - The SHM transport is torn down (e.g., session resumption on a new conduit, or peer crash)
- The shared memory region is unmapped
- Code still holding the
SelfRefaccesses the data — dangling pointer
What needs investigation
- Can
SelfRefoutlive the SHM region in practice? What are the ownership/lifetime guarantees? - Does the ring buffer slot stay pinned while a
SelfRefreferences it? - If not, what prevents the slot from being recycled while a borrow is outstanding?
Discovered while working on the retry spec (#231) — session resumption on a new conduit implies the old transport can be torn down while responses from it are still in use.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels