rust-embedded-community / async-on-embedded

Apache License 2.0
122 stars 11 forks source link

{task,Executor}::block_on are unsound #6

Open Nemo157 opened 4 years ago

Nemo157 commented 4 years ago

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.

Disasm commented 4 years ago

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

Nemo157 commented 4 years ago

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