async-on-embedded icon indicating copy to clipboard operation
async-on-embedded copied to clipboard

{task,Executor}::block_on are unsound

Open Nemo157 opened this issue 5 years ago • 2 comments

It is possible for the future passed to block_on to stash a clone of the provided Waker somewhere, then call wake on it after completion, resulting in an attempt to access the ready variable from the freed block_on stack.

Nemo157 avatar Jun 15 '20 08:06 Nemo157

Hmm, is it possible to save this waker in a safe way?

Disasm avatar Jun 15 '20 09:06 Disasm

Yes, it could be put into a static WAKER: RefCell<Option<Waker>>; or similar construct.

Nemo157 avatar Jun 15 '20 09:06 Nemo157