queue: fix NULL deref in _io_uring_get_cqe() for EXT_ARG_REG path#1581
Merged
Conversation
Owner
|
Looks reasonable, but please follow the commit guide for liburing. Basically everything you put in here needs to go in the commit message, but please keep it less LLM and more normal reading (and shorter). And you need a |
0dce0a9 to
742bbae
Compare
Contributor
Author
|
Thanks for the feedback. I've rewritten the commit message to be shorter and plain — no more verbose structure, and the key info is in the body now. Also added the Signed-off-by line. PR description updated to match. |
When io_uring_submit_and_wait_reg() is used, data->arg holds a register offset cast to void *, not a pointer to io_uring_getevents_arg. If no CQE is available on the first pass, the looped && has_ts branch dereferences data->arg as a struct pointer, which causes a segfault. Fix this by checking IORING_ENTER_EXT_ARG_REG in get_flags before the dereference. For the registered-wait path the kernel handles the timeout, so return -ETIME directly without touching data->arg. Fixes axboe#1567. Signed-off-by: XananasX <cihbank069@gmail.com>
742bbae to
19903c3
Compare
Owner
|
Thanks, that looks much better. I'll run this through some testing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When io_uring_submit_and_wait_reg() is used, data->arg holds a register
offset cast to void *, not a pointer to io_uring_getevents_arg. If no CQE
is available on the first pass, the looped && has_ts branch dereferences
data->arg as a struct pointer, which causes a segfault.
Fix this by checking IORING_ENTER_EXT_ARG_REG in get_flags before the
dereference. For the registered-wait path the kernel handles the timeout,
so return -ETIME directly without touching data->arg.
Fixes #1567.