Repository navigation
docs(fast_io): audit mmap + io_uring co-usage sites - #3440
Merged
Merged
Conversation
Audit every site in fast_io, engine, match (and their immediate transfer and checksum callers) where mmap'd memory is - or could be - handed to io_uring. Inventories all mmap and io_uring submission sites, classifies risk per site, compares against upstream rsync 3.4.1's deliberate avoidance of mmap for basis files (fileio.c:214-217), and records six findings (F1-F6) plus actionable recommendations. Key conclusion: today no production path mixes mmap with io_uring; the wired receiver uses BufferedMap (matching upstream's sliding-read window) and IoUringDiskBatch always copies into its own buffer before submission. The one latent hazard is the dormant DeltaApplicator, which uses adaptive mmap basis but writes via plain File - if it is ever wired with an io_uring writer, the basis must be switched to BufferedMap or copied before SQE submission to preserve upstream's SIGBUS-on-truncate immunity. No code changes.
This was referenced Apr 29, 2026
oferchen
added a commit
that referenced
this pull request
May 1, 2026
Audit every site in fast_io, engine, match (and their immediate transfer and checksum callers) where mmap'd memory is - or could be - handed to io_uring. Inventories all mmap and io_uring submission sites, classifies risk per site, compares against upstream rsync 3.4.1's deliberate avoidance of mmap for basis files (fileio.c:214-217), and records six findings (F1-F6) plus actionable recommendations. Key conclusion: today no production path mixes mmap with io_uring; the wired receiver uses BufferedMap (matching upstream's sliding-read window) and IoUringDiskBatch always copies into its own buffer before submission. The one latent hazard is the dormant DeltaApplicator, which uses adaptive mmap basis but writes via plain File - if it is ever wired with an io_uring writer, the basis must be switched to BufferedMap or copied before SQE submission to preserve upstream's SIGBUS-on-truncate immunity. No code changes.
2 tasks done
oferchen
added a commit
that referenced
this pull request
May 1, 2026
) (#3493) Documents the hazard that arises when IORING_SETUP_SQPOLL is enabled and SQEs reference mmap'd basis-file pages that are not yet resident: the kthread context cannot service major page faults the way a userspace task can, leading to stalls, fall-back to task-work, or -EFAULT completions. Companion to docs/audits/mmap-iouring-co-usage.md (#3440). Records the constraint so that whoever wires SQPOLL prefaults or avoids mmap on the basis side first. Salvaged from worktree branch docs/mmap-page-fault-sqpoll.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
Audit every site in fast_io, engine, match (and their immediate transfer and checksum callers) where mmap'd memory is - or could be - handed to io_uring. Inventories all mmap and io_uring submission sites, classifies risk per site, compares against upstream rsync 3.4.1's deliberate avoidance of mmap for basis files (fileio.c:214-217), and records six findings (F1-F6) plus actionable recommendations. Key conclusion: today no production path mixes mmap with io_uring; the wired receiver uses BufferedMap (matching upstream's sliding-read window) and IoUringDiskBatch always copies into its own buffer before submission. The one latent hazard is the dormant DeltaApplicator, which uses adaptive mmap basis but writes via plain File - if it is ever wired with an io_uring writer, the basis must be switched to BufferedMap or copied before SQE submission to preserve upstream's SIGBUS-on-truncate immunity. No code changes.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
) (#3493) Documents the hazard that arises when IORING_SETUP_SQPOLL is enabled and SQEs reference mmap'd basis-file pages that are not yet resident: the kthread context cannot service major page faults the way a userspace task can, leading to stalls, fall-back to task-work, or -EFAULT completions. Companion to docs/audits/mmap-iouring-co-usage.md (#3440). Records the constraint so that whoever wires SQPOLL prefaults or avoids mmap on the basis side first. Salvaged from worktree branch docs/mmap-page-fault-sqpoll.
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
Task #1660. Audit every site in
crates/fast_io/,crates/engine/,crates/match/(and their immediate transfer / checksum callers) wheremmap'd memory is - or could be - passed to io_uring. New file:
docs/audits/mmap-iouring-co-usage.md. No code changes.data-submission sites; cross-references where they meet today.
mmap(2)for basis files (fileio.c:214-217, "another program ...truncating the file thus giving us a SIGBUS"). Our
BufferedMapis aone-to-one match for upstream's
map_filesemantics.DeltaApplicatorseam, two LOW hardening items(
MmapReader::opendefaults,IoUringWriter::writebypass docs), andthree INFO findings (positive:
IoUringDiskBatchand the streamingtoken-loop already isolate io_uring from any potential mmap; the
RawIoUringfield-drop ordering is correct and load-bearing).co-usage today; the only realistic hazard is wiring
DeltaApplicatorwith an io_uring writer without switching its basis to
BufferedMap.Test plan
git diff --stat origin/mastershows only the new audit document.docs/audits/documents(
apple-fs-roundtrip.md).