Skip to content

[GIT PULL] queue: check EXT_ARG support before flushing registered waits - #1628

Merged
axboe merged 1 commit into
axboe:masterfrom
srkyn:fix/reg-wait-feature-check
Aug 19, 2026
Merged

axboe merged 1 commit into
axboe:masterfrom
srkyn:fix/reg-wait-feature-check

Conversation

@srkyn

@srkyn srkyn commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This moves the existing feature check ahead of __io_uring_flush_sq().

I reproduced the current behavior with an active SQPOLL ring: the helper returned -EINVAL, but a tagged NOP still completed because the SQ tail had already been published. With this change, the same call returns -EINVAL without publishing the pending SQE.

Tests:

  • reg-wait.t with GCC
  • reg-wait.t with Clang ASan/UBSan
  • focused sanitizer set: reg-wait.t, submit-and-wait.t, sqpoll-sleep.t, sqpoll-exec.t, sq-poll-kthread.t, and sq-poll-share.t

The full GCC suite also ran. reg-wait.t passed. Four unrelated failures reproduced on unpatched current upstream, and a fifth transient test passed on three immediate retries and on the upstream control.

io_uring_submit_and_wait_reg() initializes get_data before checking
IORING_FEAT_EXT_ARG. The initializer calls __io_uring_flush_sq(), so an
unsupported call returns -EINVAL after advancing the private SQ head and
publishing the SQ tail.

That can strand pending entries on a normal ring. If an SQPOLL thread is
active, it can execute them even though the helper returned an error.

Check the feature first, as io_uring_submit_and_wait_min_timeout()
already does. Add a regression test which verifies that the unsupported
path leaves both the private SQ head and published SQ tail unchanged.

Fixes: a436470 ("Add support for registered waits")
Signed-off-by: David Sarkisyan <[email protected]>
@axboe
axboe merged commit 27255f4 into axboe:master Aug 19, 2026
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