Repository navigation
docs(fast_io): audit io_uring bgid u16 namespace exhaustion risk (#2044) - #3509
Merged
Merged
Conversation
oferchen
added a commit
that referenced
this pull request
May 5, 2026
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.
Summary
Audits whether io_uring's 16-bit buffer-group identifier (
bgid) can be exhausted by oc-rsync at scale (issue #2044). Findings:bgidnamespace is per io_uring instance, not per-process; eachRawIoUringhas its own0..=u16::MAXslot table maintained byio_uring/kbuf.c::io_register_pbuf_ring().bgidvalues in production today:BufferRing/BufferRingConfigexist atcrates/fast_io/src/io_uring/buffer_ring.rsand are re-exported viacrates/fast_io/src/io_uring/mod.rs:100andcrates/fast_io/src/lib.rs:155, but no caller constructs them outside unit tests.IoUringReader/IoUringWriter/IoUringSocketReader/IoUringSocketWriter/IoUringDiskBatchowns its ownRawIoUring, so any futureBufferRingwould naturally be one-per-fd.bgid = 0for the primary ring perRawIoUring, and add a debug warn if any single ring crosses ~256 live buffer groups. A sketch of an allocator (option (b)) is included in case the architecture ever changes.Guarantees
docs/audits/io-uring-bgid-namespace.md(322 lines); no code, configuration, or other docs are touched.path:linereferences resolve in the current tree (buffer_ring.rs:41,44,60-66,134-152,151,159,267-397,414,516-553,mod.rs:100,lib.rs:155, plus per-fd ring construction sites infile_reader.rs:60,file_writer.rs:54,81,141,socket_reader.rs:32,socket_writer.rs:32,disk_batch.rs:46,71).iouring-pipe-stdio.md,iouring-socket-sqpoll-defer-taskrun.md, andmadvise-willneed-prefault.md(Summary / Current state / Risk / Recommendation / References) and stays under 500 lines.docs(fast_io):prefix on commit and PR title, no em-dashes anywhere in the new file.Test plan
tools/enforce_limits.shclean (docs-only change, no LoC impact).path:lineanchors).