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
I'm pretty sure this crate ends up aliasing mutable references, as each future, when polled, holds a mutable reference to the data at the same time as the linked list does.
As an example: suppose there is a ManualResetEvent, and this happens:
.wait() is called, and the future is polled once. This will insert a raw pointer to its WaitQueueEntry inside the ManualResetEvent's linked list.
At this point, we have a mutable reference to the WaitQueueEntry transitively through the future.
.set() is called. This then calls LinkedList::reverse_drain, which creates a &mut ListNode<WaitQueueEntry> that aliases with the one held by the future. This is UB.
However I couldn't get Miri to trigger on this, so I'm not sure.
The text was updated successfully, but these errors were encountered:
I believe this is true, but I also don't think it's possible to resolve this without something like AliasedCell from rust-lang/rust#63818, because Future::poll receives a Pin<&mut Self> argument and therefore always borrows the entire thing, even if we don't want to.
IIRC a number of tests in this crate fail under miri because of this.
I'm pretty sure this crate ends up aliasing mutable references, as each future, when polled, holds a mutable reference to the data at the same time as the linked list does.
As an example: suppose there is a
ManualResetEvent
, and this happens:.wait()
is called, and the future is polled once. This will insert a raw pointer to itsWaitQueueEntry
inside theManualResetEvent
's linked list.WaitQueueEntry
transitively through the future..set()
is called. This then callsLinkedList::reverse_drain
, which creates a&mut ListNode<WaitQueueEntry>
that aliases with the one held by the future. This is UB.However I couldn't get Miri to trigger on this, so I'm not sure.
The text was updated successfully, but these errors were encountered: