You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because somebody could clone the FlowRef, stash it somewhere, call deref_mut on it, and then race with others. These races can cause use after free. For example, consider one thread pushing onto a Vec, causing reallocation, while another thread accesses that Vec.
Activity
notriddle commentedon Nov 3, 2016
FlowRefis an Arc, so the underlyingFlowwon't be freed until allFlowRefs go away. How could this result in use-after-free?pcwalton commentedon Nov 3, 2016
Because somebody could clone the FlowRef, stash it somewhere, call
deref_muton it, and then race with others. These races can cause use after free. For example, consider one thread pushing onto a Vec, causing reallocation, while another thread accesses that Vec.pcwalton commentedon Nov 3, 2016
Layout must not have direct access to
FlowRef. It must only interact with borrowed Flows.notriddle commentedon Nov 3, 2016
That makes sense.
Auto merge of #14053 - notriddle:flow_ref_unsafe, r=<try>
Auto merge of #14053 - notriddle:flow_ref_unsafe, r=<try>
Auto merge of #14053 - notriddle:flow_ref_unsafe, r=<try>
Auto merge of #14053 - notriddle:flow_ref_unsafe, r=pcwalton