Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

futures_task::waker_ref() is unsound #2795

Closed
js2xxx opened this issue Oct 29, 2023 · 0 comments · Fixed by #2830
Closed

futures_task::waker_ref() is unsound #2795

js2xxx opened this issue Oct 29, 2023 · 0 comments · Fixed by #2830
Labels
A-task Area: futures::task bug

Comments

@js2xxx
Copy link

js2xxx commented Oct 29, 2023

The requirements of futures_task::waker(a) and futures_task::waker_ref(&a) for all a should be the same. However in the current implementation, the former requires a to be 'static, while the latter does not. This enables a static Waker to be obtained from a non-static a, resulting in some potential use-after-free problem.

@taiki-e taiki-e added bug A-task Area: futures::task labels Feb 25, 2024
pdh11 added a commit to pdh11/cotton that referenced this issue Oct 5, 2024
This is a complicated one. There was a soundness bug in futures-task
rust-lang/futures-rs#2795 so it was fixed in a
point release (0.3.31) even though it's a breaking change.

But other crates, including futures-util, weren't updated to "depend on"
the newer release, even though they now don't compile against the older
release.

This suddenly broke the cotton-minver build, which used the old
futures-util 0.3.11 (because it *directly* depends on it) but the new
futures-task 0.3.31 (because it only *indirectly* depends on it, and the
minver build does direct-minimal-versions only).

Fix this by depending on a later version of futures-util.
magicant added a commit to magicant/yash-rs that referenced this issue Oct 21, 2024
All futures-util versions prior to 0.3.31 have been yanked because of a
soundness bug [1]. This commit updates the futures family of crates to
0.3.31.

[1]: rust-lang/futures-rs#2795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-task Area: futures::task bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants