Skip to content

docs(fast_io): audit mmap + io_uring co-usage sites - #3440

Merged
oferchen merged 1 commit into
masterfrom
docs/mmap-iouring-audit
Apr 29, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/mmap-iouring-audit

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Task #1660. Audit every site in crates/fast_io/, crates/engine/,
crates/match/ (and their immediate transfer / checksum callers) where
mmap'd memory is - or could be - passed to io_uring. New file:
docs/audits/mmap-iouring-co-usage.md. No code changes.

  • Inventories all mmap sites (file-backed and ring-fd) and all io_uring
    data-submission sites; cross-references where they meet today.
  • Compares against upstream rsync 3.4.1, which deliberately avoids
    mmap(2) for basis files (fileio.c:214-217, "another program ...
    truncating the file thus giving us a SIGBUS"). Our BufferedMap is a
    one-to-one match for upstream's map_file semantics.
  • Records six findings (F1-F6): one MEDIUM-latent on the dormant
    DeltaApplicator seam, two LOW hardening items
    (MmapReader::open defaults, IoUringWriter::write bypass docs), and
    three INFO findings (positive: IoUringDiskBatch and the streaming
    token-loop already isolate io_uring from any potential mmap; the
    RawIoUring field-drop ordering is correct and load-bearing).
  • Concludes the production transfer path is free of mmap + io_uring
    co-usage today; the only realistic hazard is wiring DeltaApplicator
    with an io_uring writer without switching its basis to BufferedMap.

Test plan

  • git diff --stat origin/master shows only the new audit document.
  • No source files changed; nothing to compile or test.
  • Markdown style matches existing docs/audits/ documents
    (apple-fs-roundtrip.md).

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.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 29, 2026
@oferchen
oferchen merged commit 6e61f41 into master Apr 29, 2026
12 checks passed
@oferchen
oferchen deleted the docs/mmap-iouring-audit branch April 29, 2026 10:21
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant