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

maitake: fix rust-lang/miri#3780, actually run Miri on CI #483

Merged
merged 3 commits into from
Aug 3, 2024

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Aug 2, 2024

This reproduces a potential UB where a task::Cell gets niche-optimized in the Joined case. This is based on the test added to Tokio in tokio-rs/tokio#6744

This reproduces a potential UB where a `task::Cell` gets niche-optimized
in the `Joined` case. This is based on the test added to Tokio in
tokio-rs/tokio#6744
See [this comment][1]. Adding `#[repr(C)]` to this type suppresses niche
optimization, resolving potential unsoundness that could occur when the
compiler decides to niche-optimize a self-referential future type. In
practice this probably doesn't actually happen, but we should make sure
it never does.

[1]: rust-lang/miri#3780 (comment)
It turns out CI only ever runs Miri tests for `cordyceps`, not
`maitake`/`maitake-sync`. MY BAD LOL.

This PR fixes that. In doing so, I've also had to go through and change
a bunch of tests to spawn fewer tasks when running under Miri, so that
it doesn't take a really long time to run. Most of the issues we hope
Miri catches don't actually depend on concurrency --- we have `loom`
tests for that.
@hawkw hawkw marked this pull request as ready for review August 3, 2024 18:37
@hawkw hawkw changed the title test(maitake): Miri test for rust-lang/miri#3780 maitake: fix rust-lang/miri#3780, actually run Miri on CI Aug 3, 2024
@hawkw hawkw enabled auto-merge (rebase) August 3, 2024 18:47
@hawkw hawkw disabled auto-merge August 3, 2024 18:56
@hawkw hawkw merged commit 0692c10 into main Aug 3, 2024
19 checks passed
hawkw added a commit that referenced this pull request Aug 3, 2024
This reproduces a potential UB where a `task::Cell` gets niche-optimized
in the `Joined` case. This is based on the test added to Tokio in
tokio-rs/tokio#6744
hawkw added a commit that referenced this pull request Aug 3, 2024
See [this comment][1]. Adding `#[repr(C)]` to this type suppresses niche
optimization, resolving potential unsoundness that could occur when the
compiler decides to niche-optimize a self-referential future type. In
practice this probably doesn't actually happen, but we should make sure
it never does.

[1]: rust-lang/miri#3780 (comment)
@hawkw hawkw deleted the eliza/cell-miri branch August 3, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant