sentry/aio: validate nrEvents in io_setup#13518
Open
TristanInSec wants to merge 1 commit into
Open
Conversation
io_setup reads nrEvents as int32 and casts to uint32 with no validation. Negative values wrap to large unsigned values (e.g. -1 becomes 4294967295), and zero is accepted despite being invalid. Each io_submit against such a context spawns a goroutine, allowing unbounded sentry memory growth. Linux rejects nr_events == 0 with EINVAL and caps against aio_max_nr (default 65536) in do_io_setup(). Add bounds checking before the uint32 cast: reject values <= 0 and values exceeding 65536.
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.
io_setup reads nrEvents as int32 and casts to uint32 with no validation. Negative values wrap to large unsigned values (e.g. -1 becomes 4294967295), and zero is accepted despite being invalid. Each io_submit against such a context spawns a goroutine, so an uncapped maxOutstanding allows unbounded sentry memory growth.
Linux rejects
nr_events == 0with EINVAL and caps againstaio_max_nr(default 65536) indo_io_setup().This adds bounds checking before the uint32 cast: reject values <= 0 and values exceeding 65536.