Skip to content

coop-threads: reject unknown clocks in __wasilibc_futex_wait - #929

Merged
alexcrichton merged 1 commit into
WebAssembly:mainfrom
ricochet:coop-futex-invalid-clock
Dec 3, 2026
Merged

alexcrichton merged 1 commit into
WebAssembly:mainfrom
ricochet:coop-futex-invalid-clock

Conversation

@ricochet

@ricochet ricochet commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

__wasilibc_futex_wait didn't validate the clock. With a clock other than CLOCK_MONOTONIC or CLOCK_REALTIME, a relative wait was treated as monotonic and an absolute wait hit the assert in wait_timeout (or was treated as CLOCK_REALTIME with asserts disabled). It now returns -EINVAL, like the other argument checks.

Adds coop_futex_invalid_clock.c, which fails without the fix.

A timed wait with a clock other than CLOCK_MONOTONIC or CLOCK_REALTIME
was treated as monotonic for a relative timeout, and hit an assert in
wait_timeout for an absolute one (or was treated as CLOCK_REALTIME with
asserts disabled). Return -EINVAL instead, like the other argument checks.
@alexcrichton
alexcrichton enabled auto-merge (squash) December 3, 2026 22:39
@alexcrichton
alexcrichton merged commit 4555ea5 into WebAssembly:main Dec 3, 2026
72 of 74 checks passed
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.

2 participants