Skip to content

Add futex wake-path store-buffering reproduction - #1228

Draft
Weiteng Chen (CvvT) wants to merge 1 commit into
mainfrom
weiteng/futex_bug_reproduce
Draft

Add futex wake-path store-buffering reproduction#1228
Weiteng Chen (CvvT) wants to merge 1 commit into
mainfrom
weiteng/futex_bug_reproduce

Conversation

@CvvT

Copy link
Copy Markdown
Contributor

Reproduce the lost wakeup where FutexManager::wake's relaxed done store races the waiter's SeqCst WAITING store: on x86 TSO each side can read the other's stale value, so the waker's fetch_update observes RUNNING_IN_HOST and skips the wake while the waiter blocks and times out.

Add a test-only ordering_stress rendezvous module, compiled under cfg(test) or the new futex_ordering_stress feature, that aligns the two conflicting stores and records whether each side saw the other's old value.

Two unit tests added to trigger the bug: one using mock platform and the other one uses Linux platform. To run them:

RUSTFLAGS="-C debug-assertions=on" LITEBOX_FUTEX_STRESS_ITERS=200000   cargo test -p litebox_platform_linux_userland --release   stress_real_platform_reproduces_lost_wake -- --ignored --nocapture
RUSTFLAGS="-C debug-assertions=on" LITEBOX_FUTEX_STRESS_ITERS=200000   cargo test -p litebox --release   stress_registered_waiter_does_not_miss_wake -- --ignored --nocapture

See #820 for more details about this bug.

Reproduce the lost wakeup where FutexManager::wake's relaxed `done` store
races the waiter's SeqCst `WAITING` store: on x86 TSO each side can read the
other's stale value, so the waker's fetch_update observes RUNNING_IN_HOST and
skips the wake while the waiter blocks and times out.

Add a test-only `ordering_stress` rendezvous module, compiled under cfg(test)
or the new `futex_ordering_stress` feature, that aligns the two conflicting
stores and records whether each side saw the other's old value.

- litebox: ignored probabilistic `stress_registered_waiter_does_not_miss_wake`
  over the mock platform, driving the real wake/fetch_update path.
- litebox_platform_linux_userland: a real-platform liveness stress test plus a
  feature-gated tight reproduction exercising real FUTEX_WAIT/FUTEX_WAKE.
@CvvT Weiteng Chen (CvvT) added the must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. label Aug 26, 2026
@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 No breaking API changes detected

Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant