Skip to content

redis: pin the C10 torn-read hole (equal-length replacement) with a reproduction test - #5

Draft
b7r6 wants to merge 2 commits into
mainfrom
fix/redis-read-integrity-v2
Draft

b7r6 wants to merge 2 commits into
mainfrom
fix/redis-read-integrity-v2

Conversation

@b7r6

@b7r6 b7r6 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

What and why

Lane A stability fix from the findings catalog (see nativelink-findings-2026-10-05.csv
on the meta/findings-catalog-2026-10-05 branch), rebased onto OSS main
@bf4b3aa855. This fork PR exists to validate the change on CI that is
representative of upstream PR lanes (public read-only cache, same endpoints)
before any upstream submission.

How was this verified?

The branch carries its own regression tests (fails-without where the fix
class allows it — see the branch's test commits). This PR's purpose is the
full representative CI run; green here rehearses the exact checks an
upstream PR would face.

Risk

Fork-internal validation PR; nothing lands anywhere by merging this. The
underlying fix's risk assessment happens at upstream-submission time.

AI assistance

Agent-assisted pipeline (Claude) for rebase and PR mechanics under my
direction; the fix itself carries verification in its tests.

b7r6 added a commit that referenced this pull request Oct 2, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@b7r6
b7r6 force-pushed the main branch 2 times, most recently from 83c1f81 to a9c6801 Compare October 4, 2026 22:41
@b7r6
b7r6 force-pushed the fix/redis-read-integrity-v2 branch 4 times, most recently from 3245901 to 44daaf1 Compare October 8, 2026 17:51
@b7r6
b7r6 force-pushed the fix/redis-read-integrity-v2 branch 2 times, most recently from 38d5bc9 to a754819 Compare October 15, 2026 11:19
Completes the no-per-PR-OCI-builds intent: image-off-pr moved image.yaml off
PRs and TraceMachina#2877 moved the nix integration job off PRs, but main.yaml's
integration-tests (docker-compose image build + run_integration_tests.sh)
fell between them and still ran on every PR. Defer to nightly + merge-to-main,
matching TraceMachina#2880's pattern. Fork-local until folded into the upstream OCI/nightly
set.
… residual)

PR TraceMachina#2841 added length + existence guards to the chunked Redis read path.
Astra's C10 audit flagged that length checking cannot establish stable
value identity: if a key's value is replaced by a *different* value of
the same total length between chunk reads, the reader stitches bytes from
two values and serves a torn blob as success. STRLEN is identical the
whole way through, so no length-based guard can catch it.

This confirms the hole is reachable and ships a reproduction, rather than
a shallow length patch that would not close it. `get_part` reads a value
larger than `read_chunk_size` with one `GETRANGE` per chunk, each a
separate round-trip; values are mutable (`update` writes a temp key then
`RENAME`s it onto the final key, discarding whatever was there). Content
addressing makes this a non-issue for CAS, but the AC / scheduler /
arbitrary-key uses of this same driver mutate values legitimately, so an
equal-length replacement interleaved between two chunk reads tears the
result. The new test drives exactly that interleaving through the mock
connection and asserts the current code returns head-of-A spliced onto
tail-of-B as Ok.

Why no point fix here: closing equal-length replacement requires a
snapshot-consistent read across more than one round-trip. On plain Redis
strings that is only achievable by (a) reading the whole range in one
atomic command (EVAL / MULTI), which materializes the entire value in a
single reply and is unbounded for large blobs, or (b) attaching a
version/identity to the value that `update` writes and `get_part` checks
across chunks -- a change to the write path and the key/value schema.
Both change the store read/write contract broadly, so the complete fix
is RFC-track rather than a local patch. The single-chunk read path is
already atomic and unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant