forge
Explore
Log in

Don't you dare go Hollow

lanes: the shared oracle gets the depth-correct, byte-checked rungs (zero-window swap)

Browse files at this commit

4b63be1964d8cf1fb7edc547331c3a54fefb928fAhmet Kaan GümüşParent: c755a39
The private copy was never the problem: ~/.cache/aom-oracle shipped the same four
broken rungs, so every lane that ever paired against them on a 10/12-bit stream
got a 0-byte file -- which reads downstream as "the oracle has no data for this
stage" and becomes a phantom stage diff.

Swapped with no window, because ps showed a live lane (cargo-target-av1lm444corr,
a_10bit_film_frames_with_frame_edge_mv_clamping...) exec'ing the shared aomenc
at that moment: hardlink backup aomdec.prefix-20260929-054321 + source copy in
revert/, source edit (a file no running process reads), ninja libaom.a only, the
link command re-run with -o to a scratch path, the new binary verified fully
OFF-PATH, then one mv (inode 177294570 -> 177592760). Revert:
  mv ~/.cache/aom-oracle/build/aomdec.prefix-20260929-054321 ~/.cache/aom-oracle/build/aomdec
  git -C ~/.cache/aom-oracle/src checkout -- av1/decoder/decodeframe.c

Verified ON the shared binary after the flip: five rungs exit 0 on av112bit-key.obu
(12-bit, 30720 B each; rung 12 61440 B) and palette_screen_witness_10bit.obu
(10-bit, 73728 B each; rung 12 147456 B); 8/8 byte-identical to the decoder's as
u8 rows; 8-bit no-op vs the backed-up OLD binary 10/10 IDENTICAL (32768 B and
6144 B). Loudness proven live in the shared tree by a mutant also linked off-path
(12-bit: exit 134, expect=30720 wrote=30560; 8-bit: expect=6144 wrote=6080).
check-aom-oracle-rungs.sh against the shared source: 10 ok, exit 0.

Naming: no lane in today's waves (3a: av1cmpaudit/av1leftwit/av1lossy128x96/
av1pinslive/av1txsearch; 3b: av1rawhelper/av1oracleskip) paired against these four
rungs -- cmpaudit records them as having no in-repo consumer, rawhelper names
PREFILT only as dump_yuv's documented contract and gates on rung 12, oracleskip is
the aomenc-SKIP class. No test anywhere sets those env vars, so no automated gate
could rest on a 0-byte dump. Historical users were 8-bit lanes, where the old
rungs were correct.
lanes/av1oraclehbd.report.mdmodified+128 -0
@@ -296,3 +296,131 @@ Re-ran the full pairing after wiring the checker: `av112bit-key.obu` (12-bit)
296 and `palette_screen_witness_10bit.obu` (10-bit), all four rungs, oracle vs296 and `palette_screen_witness_10bit.obu` (10-bit), all four rungs, oracle vs
297 decoder — all `IDENTICAL` (30720 B and 73728 B). The checker only reads297 decoder — all `IDENTICAL` (30720 B and 73728 B). The checker only reads
298 `ftell`; it cannot move a byte.298 `ftell`; it cannot move a byte.
299+
300+## 9. Round 3 — the SHARED oracle is fixed too (this is where the harm lived)
301+
302+The private copy was never the problem. `~/.cache/aom-oracle` shipped the same
303+four broken rungs, so **every lane that ever paired against them on a 10/12-bit
304+stream got a 0-byte file**, and a 0-byte file reads downstream as "the oracle has
305+no data for this stage".
306+
307+### 9.1 Zero-window swap (a live lane was using it)
308+
309+`ps` showed `~/.cache/cargo-target-av1lm444corr` running
310+`a_10bit_film_frames_with_frame_edge_mv_clamping_decode_pixel` with the shared
311+`aomenc` exec'd 0 s earlier, so a plain `ninja -C build aomdec` would have
312+truncated the shared binary in place for the ~3 s of the link. Instead:
313+
314+1. `ln build/aomdec build/aomdec.prefix-20260929-054321` (hardlink backup, no
315+ path gap) and `cp src/av1/decoder/decodeframe.c revert/decodeframe.c.prefix-20260929-054321`;
316+2. the repaired `decodeframe.c` copied into the shared src (a file no running
317+ process reads);
318+3. `ninja -C build libaom.a` only (2.6 s) — the shared `aomdec` path is never
319+ written;
320+4. the link command from `ninja -t commands aomdec` re-run with
321+ `-o ~/.cache/tmp/hbd-swap/aomdec.new`, so the new binary was built and
322+ fully verified OFF-PATH;
323+5. one `mv` (`rename(2)`, same filesystem): inode 177294570 (old) -> 177592760
324+ (new). A concurrent exec gets either the old inode or the new one, never a
325+ partial file.
326+
327+**Revert, one command each:**
328+
329+```
330+mv ~/.cache/aom-oracle/build/aomdec.prefix-20260929-054321 ~/.cache/aom-oracle/build/aomdec
331+git -C ~/.cache/aom-oracle/src checkout -- av1/decoder/decodeframe.c
332+```
333+
334+(The source revert is enough on its own for any future re-derivation;
335+ `ninja -C ~/.cache/aom-oracle/build aomdec` then rebuilds. `av1/common/reconintra.c`
336+ was already modified before this lane and was not touched.)
337+
338+### 9.2 Verified on the SHARED binary, after the flip
339+
340+`~/.cache/aom-oracle/build/aomdec`, five rungs, exit codes and sizes:
341+
342+| fixture | PREFILT | POSTDEBLOCK | PREFILT_WIDE | POSTCDEF | FINAL (rung 12) |
343+|---|---|---|---|---|---|
344+| `av112bit-key.obu` (12-bit) | 0, 30720 B | 0, 30720 B | 0, 30720 B | 0, 30720 B | 0, 61440 B |
345+| `palette_screen_witness_10bit.obu` (10-bit) | 0, 73728 B | 0, 73728 B | 0, 73728 B | 0, 73728 B | 0, 147456 B |
346+
347+Byte-identical to the decoder's own `as u8` rows (decode_probe, same env var):
348+8/8 `IDENTICAL` (4 rungs x 2 fixtures).
349+
350+8-bit no-op on the shared pair — new binary vs the hardlinked OLD one:
351+`422_allskip_2f.obu` 32768 B and `golden4-pin.obu` 6144 B, all five rungs,
352+**10/10 `IDENTICAL`**, both exit 0. Nothing that was correct at 8 bit moved.
353+
354+### 9.3 The loudness is live in the shared tree too
355+
356+The deliberate-mismatch mutant was also built OFF-PATH from the shared source
357+(mutated `decodeframe.c` -> object compiled to a scratch path -> `ar r` into a
358+*copy* of `libaom.a` -> linked to `aomdec.mutant`), so the shared path never
359+held an aborting oracle. One dropped luma row in PREFILT:
360+
361+```
362+12-bit: exit 134 EC_DUMP_ABORT rung=EC_AV1_PREFILT_DUMP bit_depth=12 hbd=1 expect=30720 wrote=30560
363+ 8-bit: exit 134 EC_DUMP_ABORT rung=EC_AV1_PREFILT_DUMP bit_depth=8 hbd=0 expect=6144 wrote=6080
364+```
365+
366+(First attempt at this proof silently passed because `ar q` APPENDS a
367+duplicate member instead of replacing it and the linker took the first — `ar r`
368+ is the replace verb. Worth knowing before anyone repeats the trick.)
369+
370+### 9.4 `check-aom-oracle-rungs.sh` against the shared source
371+
372+`bash scripts/check-aom-oracle-rungs.sh ~/.cache/aom-oracle/src`:
373+
374+```
375+ok legacy u8 row loops left in the derived file 0
376+ok ec_dump_narrow_row call sites (4 rungs x 3 planes) 12
377+ok ec_dump_finish call sites (one per narrowing rung) 4
378+ok byte-count check wired into EC_AV1_PREFILT_DUMP 1
379+ok byte-count check wired into EC_AV1_POSTDEBLOCK_DUMP 1
380+ok byte-count check wired into EC_AV1_PREFILT_WIDE_DUMP 1
381+ok byte-count check wired into EC_AV1_POSTCDEF_DUMP 1
382+ok rung 12 still converts plane pointers 1
383+ok rung 12 not routed through the narrowing checker 0
384+ok instrument-aom-oracle.sh derives the depth-correct, byte-checked rungs (base v3.13.3)
385+```
386+
387+### 9.5 Who could have been misled — the naming
388+
389+**Waves merged today: nobody.** Wave 3a (`3eec02c8`: av1cmpaudit, av1leftwit,
390+av1lossy128x96, av1pinslive, av1txsearch) and wave 3b (`c6112723`:
391+av1rawhelper, av1oracleskip r1+r2+r3) — of those seven lanes:
392+
393+- `lane-av1cmpaudit` NAMES `EC_AV1_PREFILT_DUMP` once, to record that the
394+ decode-order dump rungs "have no in-repo consumer" and that the stale-dump
395+ hazard there is manual-only. It paired against none of them.
396+- `lane-av1rawhelper` names `EC_AV1_PREFILT_DUMP` twice, only as the contract
397+ `examples/dump_yuv.rs` documents itself against. Its gate is
398+ `assert_rawvideo_matches` — `aomdec --rawvideo` plus rung 12 — which is
399+ depth-correct and unaffected.
400+- `lane-av1oracleskip` is the aomenc-**SKIP** class (`have_aomenc()` returning
401+ empty and a gate calling that green). No dump-rung pairing.
402+- the other four wave-3a reports do not mention the four rungs at all.
403+
404+**No automated gate ever paired them**: `grep` over `crates/` and `tools/` finds
405+the four names only in doc comments and in the decoder-side definitions in
406+`decode.rs` — no test sets those env vars. The exposure was always a manual
407+ladder procedure, which is also why it survived so long.
408+
409+**Historical users, and why their conclusions stand**: the rungs were used by
410+earlier 8-bit lanes (av1444edge, av1444, av1444sb, av1422filter, av1422kf,
411+av1422kf2, av1422stripwrite, av1lrflush, av1intrapred, av1wavefront,
412+av1seglvl, hgkf-r2, tiny-r4, sub8-r5, mergefix-r4, sb128c-r4/r5, band63-r1,
413+golomb-r9, mc64-r1, inter4-r4, txselect-r2, sqchroma-r1, superres-r6). At
414+8 bit the old rungs were correct, and §9.2's 10/10 byte-identity against the
415+backed-up old binary is the direct proof that their output did not change.
416+The one report that both sweeps HBD cells and uses the rungs is
417+`av1formatsweep`; its two `EC_AV1_PREFILT_DUMP` pairing claims (lines 238, 290)
418+are on 8-bit 4:4:4 `testsrc2` streams, not on its 10/12-bit cells, and its
419+HBD cells pair through rung 12.
420+
421+**The honest limit of that sweep**: it is name-based over `lanes/*.md` plus a
422+targeted read of every report that mentions both a rung and an HBD marker. It
423+is not a line-by-line audit of every historical report. What it does establish
424+mechanically is the thing that matters: a 0-byte dump only ever occurred on a
425+10/12-bit stream, and any lane that paired on one would have seen a rung that
426+exited 139 — a value no report in `lanes/` quotes as a result.