Skip to content

[AUTOMATED] fix(p3): (NOVEL) decline a datatype copy split into a read-only output (DIV-55) - #252

Merged
mahaloz merged 1 commit into
mainfrom
fix/decbench-returncopysplit
Aug 3, 2026
Merged

mahaloz merged 1 commit into
mainfrom
fix/decbench-returncopysplit

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The bug

kuna emitted a block of per-byte assignments storing into a .rodata string literal, on
a return path where the binary performs no store at all.

iproute2 ip (O2-noinline, stripped) netns_add @ 0x20e10, today's build, no flags:

/* before */                                       /* after */
label_21004:                                       label_21004:
      if (v3 == -1) {                                    if (v3 == -1)
        s_822f0[0] = (char)s_822f0[0];                     return 0xffffffff;
        s_822f0[1] = SUB81(s_822f0[0],1);                flock(v3,8);
        s_822f0[2] = SUB81(s_822f0[0],2);                close(v3);
        s_822f0[3] = SUB81(s_822f0[0],3);                return 0xffffffff;
        s_822f0[4] = SUB81(s_822f0[0],4);
        s_822f0[5] = SUB81(s_822f0[0],5);
        s_822f0[6] = SUB81(s_822f0[0],6);
        s_822f0[7] = SUB81(s_822f0[0],7);
        s_822f0[8] = (char)s_822f0[8];
        s_822f0[9] = SUB81(s_822f0[8],1);
        s_822f0[10] = SUB81(s_822f0[8],2);
        s_822f0[0xb] = SUB81(s_822f0[8],3);
        s_822f0[0xc] = SUB81(s_822f0[8],4);
        s_822f0[0xd] = SUB81(s_822f0[8],5);
        s_822f0[0xe] = SUB81(s_822f0[8],6);
        s_822f0[0xf] = SUB81(s_822f0[8],7);
        return 0xffffffff;
      }
      flock(v3,8);
      close(v3);
      return 0xffffffff;

The source line is return -1; (ipnetns.c:891).

Proof the stores are phantom

  • readelf -SW ip puts .rodata at 0x7e000..0x95335 with flags A and no W;
    0x822f0 is inside it.
  • objdump -d ip | grep -E '# +822f0' returns exactly one instruction in the whole
    binary, and it is a load:
    21140: 66 0f 6f 05 a8 11 06 00 movdqa 0x611a8(%rip),%xmm0 # 822f0.
  • The decorated block 0x20f7f..0x20fb0 disassembles to mov $-1,%r13d, the canary
    compare, add $0x2048,%rsp, the pops and ret. No stores.

The mechanism (the filed one was refuted; this one is instrumented)

The triage record on main proposed declining the split for a heritage RETURN-COPY via
is_return_copy(). That predicate is dead on this path. Instrumenting
SplitDatatype::test_copy_constraints shows rc=true never reaches a successful split:

[SPLITCOPY] op=0x00020fb0:b56  rc=true  in=0x000822f0(tied=true)  out=0x000822f0(tied=true,ro=true) -> false
[SPLITCOPY] op=0x00020fb0:119b rc=false in=0x1000044a(tied=false) out=0x000822f0(tied=true,ro=true) -> true   <-- phantom producer
[SPLITCOPY] op=0x00020fb0:119c rc=false in=0x10000452(tied=false) out=0x000822f8(tied=true,ro=true) -> true   <-- phantom producer
[SPLITCOPY] op=0x00021160:b1f  rc=false in=0x000822f0(tied=true)  out=0xffffffffffffefb8(ro=false)  -> true   <-- the REAL copy site

The actual chain:

  1. strings (P1, default on) plants a typelocked char[N] at ram:0x822f0; the 16-byte
    movdqa makes ram:0x822f0(8) / ram:0x822f8(8) heritaged persistent ranges.
  2. Heritage::guard_returns inserts a synthetic glob = glob COPY before each RETURN,
    flagged return_copy and address-tied at the same address on both sides — correctly
    declined by upstream's existing gate, and then hidden by Merge::mark_internal_copies.
  3. kuna's ActionStripStackGuard (option stackguard, DIV-14, default on) strips the
    canary epilogue, leaving a bare-epilogue RETURN block that passes
    Funcdata::return_split_is_splittable.
  4. ActionReturnSplit (p8_structure/blockaction.rs:3908, inside fullloop, i.e. before
    the cleanup pool) node-splits it. CloneBlockOps::build_op_clone
    (substrate/funcdata_block.rs:3988) copies the upstream flag mask, which omits
    return_copy, and CloneBlockOps::patch_inputs re-inputs the clone from a freshly
    created unique-space COPY — so the clone is neither return_copy-marked nor
    address-tied at its own address, and both upstream guards miss it.
  5. RuleSplitCopy splits it into eight one-byte COPYs per half; the pieces land in different
    HighVariables, mark_internal_copies can no longer hide them, and P9 prints them.

The fix

One predicate in SplitDatatype::test_copy_constraints
(p3_dataflow/subflow.rs, upstream subflow.cc:2390):

// (kuna) A COPY whose output lands in a read-only address range is never a
// store the program performs; splitting it turns one invisible whole-range
// assignment into per-element assignments that survive
// `Merge::mark_internal_copies` and print as stores into `.rodata`.
let out_vn = data.obank().get(copy_op).expect("stale copy").get_out().expect("copy out");
if data.vbank().get(out_vn).expect("stale out").is_read_only() {
    return false;
}

Read-only-ness of the destination is the property that survives the clone and the
property that actually makes the statement wrong. Varnode::is_read_only already exists and
is painted from the load image's non-writable sections. The invariant is one Ghidra already
recognizes — Funcdata::fillin_read_only has a Read-only address (ram,X) is written
warning path — it is just gated behind readonlypropagate.

No option: emitting a store the program cannot perform is wrong output, not a judgment
call (CLAUDE.md: "a strict bug fix that only corrects wrong output needs no flag").
option togglerule splitcopy off already gives a bisector the pre-fix pipeline. It is
recorded as DIV-55 rather than a Convergence, because the test does not exist upstream
and the CFG shape that exposes the hole is produced by kuna's own stackguard divergence.

Deliberately not in this PR: carrying return_copy across build_op_clone. That mask is
a verbatim transcription of upstream funcdata_block.cc:982-988 and changing it would be a
second, wider divergence affecting every node-split. The read-only output test closes the
emitted-C bug on its own, corpus-wide.

Breadth and regression sweep

Whole-binary kuna decompile-all --json, before/after release builds of this worktree,
diffed per function over 12 corpus binaries:

binary functions changed -lines +lines rodata stores before/after
O2-noinline iproute2 ip 1,912 2 52 2 48 / 0
O2-noinline openssh sshd 2,042 1 64 0 64 / 0
O0 iproute2 ip 1,962 0 0 0 0 / 0
bash 3,077 0 0 0 0 / 0
tar 1,585 0 0 0 0 / 0
dpkg 986 0 0 0 0 / 0
findutils find 931 0 0 0 0 / 0
gnutls certtool 833 0 0 0 0 / 0
coreutils ls 639 0 0 0 0 / 0
coreutils sort 495 0 0 0 0 / 0
shadow useradd 485 0 0 0 0 / 0
gnutls gnutls-cli 439 0 0 0 0 / 0
total 15,386 3 116 2 112 / 0

The three changed functions are exactly the three the triage found: ip netns_add
(-18/+1), ip __get_hz (-34/+1), sshd sub_230a0 (-64/+0). Every other function in the
sweep is byte-identical.

No real store is lost. After the fix, every surviving assignment whose LHS is an
address-named global lands in a writable (WA) section, and every one of those counts is
unchanged by the fix: bash 22 (.data/.bss), tar 6 (.bss), coreutils sort 4 (.data),
dpkg 1 (.data), sshd 1 (.bss). The real copy site in netns_add (16 per-byte reads
of the literal into the stack buffer) is untouched.

Ablation, gates, test

  • make test → PARITY OK 675/675, docs/baseline.json not re-pinned.
  • make test-stages → PARITY OK 375/375; the stages baseline is re-recorded purely
    additively (369 → 375 keys), no existing assertion moved, no per-test opt-out.
  • make rust-test → green (whole workspace, docs/options.md freshness fence included).
  • make check-spec → check-spec OK (lenient mode).
  • kuna catalog --check → catalog OK (no option added: phases.toml,
    p0_knowledge/options.rs, the catalog counts and docs/options.md are untouched).

tests/stages/ghdec-returncopysplit.xml — 3 of 6 assertions pass pre-fix, 6/6 post-fix.
Real ip bytes: __get_hz at its real VMA 0x6cbf0 (433 bytes verbatim, plus one synthetic
0xc3 so the fall-through of the final call __stack_chk_fail terminates — the PLT stub is
outside the chunk, so the engine cannot know it does not return), plus the 32-byte
readonly="true" literal chunk at 0x92e50. map addr r0x92e50 char s_92e50[32] stands in
for the strings analysis pass, which does not run on a bytechunk image. Pass 1 is the default
(the fix); pass 2 sets option togglerule splitcopy off to pin the unsplit rendering.

Speed

No mechanism for a cost: one varnode-flag test per COPY that RuleSplitCopy already
considers, and a declined split does strictly less work. Interleaved A/B medians on the
two builds (scripts.pipeline.timeit is inapplicable — it measures an option flip):

target before after delta pairs
ip netns_add @0x20e10 (changed) 1,349.4 ms 1,334.9 ms -1.08% 15
ip __get_hz @0x6cbf0 (changed) 1,002.1 ms 1,006.2 ms +0.41% 15
sshd sub_230a0 (changed) 2,371.1 ms 2,117.5 ms -10.69% 15
coreutils sort decompile-all --mode reliable 5,735.1 ms 5,816.3 ms +1.42% 11
coreutils ls decompile-all --mode reliable 9,179.3 ms 8,802.5 ms -4.10% 5

Honest caveat: this box runs concurrent agents. A byte-identical control function
(ip @0x20780) measured -12.18% and -20.23% across two runs, and sort's whole-binary
output is byte-identical in both arms yet measured +9.17% on a 5-pair run and +1.42% on an
11-pair one — so anything inside roughly ±10% here is load, not signal. The changed targets'
highest-pair-count deltas are -1.08%, +0.41% and -10.69%, all inside the +5% budget.

Benchmark

scripts.decbench.rescore --case O2-noinline-iproute2-ip-netns_add:
GED 8.0 → 8.0, delta 0.0. Zero, and expected to be zero: the fix deletes statements
inside one basic block and creates or destroys no block and no edge, so the graph-edit-distance
metric cannot see it. This case is ranked by correctness, not by GED.

Full bundle: docs/features/returncopysplit/ (analysis.md, plan.md, record.json).

🤖 Generated with Claude Code

…d-only output (DIV-55)

kuna emitted a block of per-byte assignments storing into a .rodata string
literal on a return path where the binary performs no store at all:
`s_822f0[0xf] = SUB81(s_822f0[8],7);` x16 in iproute2 `ip` netns_add @0x20e10,
on the source line `return -1`.  .rodata there is 0x7e000..0x95335, flags A and
no W; the whole binary contains exactly ONE instruction that references 0x822f0
and it is the movdqa load.

Mechanism (instrumented, not inferred -- the round-2 triage's proposed
is_return_copy() predicate is REFUTED and changes nothing): `strings` plants a
typelocked char[N] at the literal, so the 16-byte SIMD read makes
ram:0x822f0(8)/ram:0x822f8(8) heritaged persistent ranges and
Heritage::guardReturns inserts its synthetic `glob = glob` return_copy before
each RETURN.  That copy is address-tied at one address on both sides, so
upstream's SplitDatatype::testCopyConstraints gate declines it and
Merge::markInternalCopies hides it.  kuna's own stackguard (DIV-14) then strips
the canary epilogue, leaving a bare-epilogue RETURN block that ActionReturnSplit
node-splits -- and CloneBlockOps::buildOpClone copies a flag mask that does not
carry return_copy while patchInputs re-inputs the clone from a fresh
unique-addressed COPY.  The clone is therefore neither return_copy-marked nor
address-tied at its own address, both upstream guards miss it, RuleSplitCopy
splits it per array element, the pieces land in different HighVariables and P9
prints them.

Fix: testCopyConstraints also declines when the COPY's OUTPUT varnode is
read-only.  Read-only-ness of the destination is the property that survives the
clone and the property that actually makes the statement wrong.  The invariant
is one Ghidra already recognises (Funcdata::fillinReadOnly warns "Read-only
address (ram,X) is written"); it is just gated behind readonlypropagate.

No option: a store the program cannot perform is wrong output, not a judgment
call, and `option togglerule splitcopy off` already reproduces the pre-fix
pipeline for bisection.  Recorded as DIV-55 (a divergence from upstream
subflow.cc:2390, not a Convergence -- nothing was restored, and the precondition
is created by kuna's own stackguard divergence).

Evidence: 675/675 PARITY OK with no re-pin; stages 375/375 with no per-test
opt-out.  Whole-binary decompile-all before/after over 12 corpus binaries /
15,386 functions changes exactly 3 functions -- ip netns_add (-18/+1), ip
__get_hz (-34/+1), openssh sshd sub_230a0 (-64/+0) -- 116 lines removed, 2
added, everything else byte-identical; 112 phantom statements go to 0 and every
surviving global store lands in a writable (WA) section with an unchanged count.
-O0 ip (1,962 functions) is byte-identical.  Speed: interleaved A/B medians,
netns_add -1.08% (15 pairs), __get_hz +0.41% (15), sshd sub_230a0 -10.69% (15),
coreutils sort decompile-all +1.42% (11) -- with a byte-identical control
function moving -20.23% on the same loaded box, so the honest reading is "no
measurable cost".  GED 8.0 -> 8.0 (removing statements moves no block or edge).
tests/stages/ghdec-returncopysplit.xml: 3 of 6 assertions pass pre-fix, 6/6
post-fix.

Bundle: docs/features/returncopysplit/.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
@mahaloz
mahaloz merged commit 1b6d4db into main Aug 3, 2026
9 checks passed
@mahaloz
mahaloz deleted the fix/decbench-returncopysplit branch August 3, 2026 09:39
mahaloz added a commit that referenced this pull request Aug 3, 2026
… not every other (DIV-56)

In a run of N structurally identical two-arm assignment diamonds, `iteregion`
and `iteboolean` recovered exactly ceil(N/2) of them (measured N=1..8:
1 1 2 2 3 3 4 4). Which ones were missed depended on the NEIGHBOURING
structure, not on the diamond itself: an immediately preceding structured `if`
suppressed the very next one.

Both matchers reach the diamond's condition component through one helper,
`kuna_iteregion.rs (leaf_bblock)`, which descends a `BlockList` of ONE
component but bails on a list of two or more -- and the collapse structurer
concatenates a just-collapsed predecessor together with the following
condition block into a two-component `BlockList` that becomes component 0 of
the NEXT `BlockIf`. Confirmed by instrumenting `match_ite_assignment`: the
folded diamonds report `cond_ty=Copy cbr=true`, the declined one
`cond_ty=Ls cond_sz=2 cbr=false`, with both arms passing every other test.

New option `itecondlist on|off` (default ON, DIV-56, ELEM 4121) descends a
condition-position `BlockList` to its LAST component before the leaf test.
Print-only and sound because the printer already renders that shape:
`emit_block_if` emits the condition component once under NO_BRANCH (its
statements) and once under ONLY_BRANCH (its branch), while `emit_block_ls`
emits every component under NO_BRANCH but only the LAST under ONLY_BRANCH.
`BlockGraph` is excluded -- `emit_block_graph` ignores ONLY_BRANCH.

Driving case decbench:O0-bash-bash-shell_initialize: GED 46 -> 24, all three
source-identical `x = a||b||c||d;` call arguments now one statement each.
Breadth over 4 binaries / 12,241 functions: 53 functions change text (0.43%),
59 additional diamonds fold, 0 problems in a mechanical audit of every hunk.
Ablation 0/675 with the flip; speed -1.07% on the target function.

Rebased onto #252 (1b6d4db, DIV-55, returncopysplit), which was dispatched
concurrently and merged first -- DIV numbers are claimed on merge, so this row
renumbered 55 -> 56. Both PRs moved the xml.rs corpus count 187 -> 188, so it
resolves to 189, and docs/baseline-stages.json was re-recorded on the merged
base (381 keys) rather than hand-merged. Every measurement was re-taken on the
rebased tree: #252 moves the OFF arm of all four sweep binaries by 0 lines, so
the breadth, changed-function, N-sweep and audit numbers reproduce exactly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
… not every other (DIV-56) (#253)

In a run of N structurally identical two-arm assignment diamonds, `iteregion`
and `iteboolean` recovered exactly ceil(N/2) of them (measured N=1..8:
1 1 2 2 3 3 4 4). Which ones were missed depended on the NEIGHBOURING
structure, not on the diamond itself: an immediately preceding structured `if`
suppressed the very next one.

Both matchers reach the diamond's condition component through one helper,
`kuna_iteregion.rs (leaf_bblock)`, which descends a `BlockList` of ONE
component but bails on a list of two or more -- and the collapse structurer
concatenates a just-collapsed predecessor together with the following
condition block into a two-component `BlockList` that becomes component 0 of
the NEXT `BlockIf`. Confirmed by instrumenting `match_ite_assignment`: the
folded diamonds report `cond_ty=Copy cbr=true`, the declined one
`cond_ty=Ls cond_sz=2 cbr=false`, with both arms passing every other test.

New option `itecondlist on|off` (default ON, DIV-56, ELEM 4121) descends a
condition-position `BlockList` to its LAST component before the leaf test.
Print-only and sound because the printer already renders that shape:
`emit_block_if` emits the condition component once under NO_BRANCH (its
statements) and once under ONLY_BRANCH (its branch), while `emit_block_ls`
emits every component under NO_BRANCH but only the LAST under ONLY_BRANCH.
`BlockGraph` is excluded -- `emit_block_graph` ignores ONLY_BRANCH.

Driving case decbench:O0-bash-bash-shell_initialize: GED 46 -> 24, all three
source-identical `x = a||b||c||d;` call arguments now one statement each.
Breadth over 4 binaries / 12,241 functions: 53 functions change text (0.43%),
59 additional diamonds fold, 0 problems in a mechanical audit of every hunk.
Ablation 0/675 with the flip; speed -1.07% on the target function.

Rebased onto #252 (1b6d4db, DIV-55, returncopysplit), which was dispatched
concurrently and merged first -- DIV numbers are claimed on merge, so this row
renumbered 55 -> 56. Both PRs moved the xml.rs corpus count 187 -> 188, so it
resolves to 189, and docs/baseline-stages.json was re-recorded on the merged
base (381 keys) rather than hand-merged. Every measurement was re-taken on the
rebased tree: #252 moves the OFF arm of all four sweep binaries by 0 lines, so
the breadth, changed-function, N-sweep and audit numbers reproduce exactly.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mahaloz added a commit that referenced this pull request Aug 3, 2026
… to its import (DIV-57)

A PE reaches its imports through an Import Address Table slot, which is *data*,
so `call dword ptr [slot]` lifts to a CALLIND through a global. The only pass
that resolves such a target - ActionDeindirect - gates on `Varnode::externref`,
and that flag was set NOWHERE in the workspace: Ghidra sets it from an
ExternRefSymbol (`Scope::addExternalRef`) the port never carried. So every
Windows API call in every PE stayed an unnamed `(*dat_4112c4)(0)` with no name,
no prototype and no no-return flow effect - a function ending in ExitThread kept
its fall-through and swallowed the whole of the next function.

Three parts behind one option (`peimportcall`, P1, default-ON, DIV-57):

1. A new PE/COFF-only analysis pass reports one `[slot, slot+ptr)` range per
   import-descriptor entry and the commit ORs `Varnode::externref` over each in
   the symbol-table property map - the same `set_property_range` the loader's
   read-only ranges use. No second symbol is mapped: kuna's `query_function`
   keys on the varnode's own address where upstream indirects through
   `ExternRefSymbol::refaddr`, and the import FunctionSymbol's 1-byte map entry
   never covers a pointer-width read, so `queryProperties` always takes the
   property branch.
2. `build_global_query` now carries the callee's no-return flag into
   `GlobalEntry`, which `query_function` puts on the prototype handed to
   ActionDeindirect. Without it `deindirect` took its lateRestriction success
   path and never scheduled the restart whose re-flow plants the artificial
   halt, so the boundary stayed wrong even once the call was named.
3. Upstream's PE-only `PEFunctionsThatDoNotReturn` is vendored verbatim and
   matched against a PE/COFF object only - kuna merged the PE and Mach-O name
   sets where upstream keeps them separate, and these names are Windows-only.

ActionDeindirect and FuncCallSpecs::deindirect are unchanged consumers. The
mechanism the triage record filed (a new P2 pass matching the CALLIND shape) was
refuted first: at that seam the target is a free unique temp and raw flow IR
carries no def-use links, so the backward walk it needs is unavailable.

Measurements: decbench `O0-mydoom-mydoom-mmsender_th` GED 37 -> 0 (perfect) and
its un-triaged sibling `sync_visual_th` 39 -> 0 (perfect); over both corpus PEs
927 unnamed IAT-slot calls -> 8 with 71/90 distinct Win32 API names recovered,
8 boundary overruns fixed, no function gained or lost, gotos never increase;
ELF/Mach-O byte-identical; timeit -1.9%, whole-binary -7.2% / -2.1%.

Rebased onto 6554346 (after #252/DIV-55 and #253/DIV-56): corpus file count 190,
settables 87 (transform tier 41, live-value 29), phase_catalog.json re-captured and
docs/baseline-stages.json re-recorded (386 keys) on the rebased tree rather than
hand-merged. Every measurement above re-run on that base; the PE and ELF witnesses are
bit-for-bit unchanged by either merge.

Gates: make test 675/675 PARITY OK (no re-pin, no per-test opt-out);
make test-stages 386/386 PARITY OK; make rust-test green;
make check-spec OK (lenient + strict); kuna catalog --check OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
… to its import (DIV-57) (#254)

A PE reaches its imports through an Import Address Table slot, which is *data*,
so `call dword ptr [slot]` lifts to a CALLIND through a global. The only pass
that resolves such a target - ActionDeindirect - gates on `Varnode::externref`,
and that flag was set NOWHERE in the workspace: Ghidra sets it from an
ExternRefSymbol (`Scope::addExternalRef`) the port never carried. So every
Windows API call in every PE stayed an unnamed `(*dat_4112c4)(0)` with no name,
no prototype and no no-return flow effect - a function ending in ExitThread kept
its fall-through and swallowed the whole of the next function.

Three parts behind one option (`peimportcall`, P1, default-ON, DIV-57):

1. A new PE/COFF-only analysis pass reports one `[slot, slot+ptr)` range per
   import-descriptor entry and the commit ORs `Varnode::externref` over each in
   the symbol-table property map - the same `set_property_range` the loader's
   read-only ranges use. No second symbol is mapped: kuna's `query_function`
   keys on the varnode's own address where upstream indirects through
   `ExternRefSymbol::refaddr`, and the import FunctionSymbol's 1-byte map entry
   never covers a pointer-width read, so `queryProperties` always takes the
   property branch.
2. `build_global_query` now carries the callee's no-return flag into
   `GlobalEntry`, which `query_function` puts on the prototype handed to
   ActionDeindirect. Without it `deindirect` took its lateRestriction success
   path and never scheduled the restart whose re-flow plants the artificial
   halt, so the boundary stayed wrong even once the call was named.
3. Upstream's PE-only `PEFunctionsThatDoNotReturn` is vendored verbatim and
   matched against a PE/COFF object only - kuna merged the PE and Mach-O name
   sets where upstream keeps them separate, and these names are Windows-only.

ActionDeindirect and FuncCallSpecs::deindirect are unchanged consumers. The
mechanism the triage record filed (a new P2 pass matching the CALLIND shape) was
refuted first: at that seam the target is a free unique temp and raw flow IR
carries no def-use links, so the backward walk it needs is unavailable.

Measurements: decbench `O0-mydoom-mydoom-mmsender_th` GED 37 -> 0 (perfect) and
its un-triaged sibling `sync_visual_th` 39 -> 0 (perfect); over both corpus PEs
927 unnamed IAT-slot calls -> 8 with 71/90 distinct Win32 API names recovered,
8 boundary overruns fixed, no function gained or lost, gotos never increase;
ELF/Mach-O byte-identical; timeit -1.9%, whole-binary -7.2% / -2.1%.

Rebased onto 6554346 (after #252/DIV-55 and #253/DIV-56): corpus file count 190,
settables 87 (transform tier 41, live-value 29), phase_catalog.json re-captured and
docs/baseline-stages.json re-recorded (386 keys) on the rebased tree rather than
hand-merged. Every measurement above re-run on that base; the PE and ELF witnesses are
bit-for-bit unchanged by either merge.

Gates: make test 675/675 PARITY OK (no re-pin, no per-test opt-out);
make test-stages 386/386 PARITY OK; make rust-test green;
make check-spec OK (lenient + strict); kuna catalog --check OK.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mahaloz added a commit that referenced this pull request Aug 3, 2026
…n entries on containment evidence

Step 2 of the approved ARM entry-recall sequence ([PROPOSAL] #239) and the one it
called the prize: 1,671 missed function entries, 56.8% of the whole ARM
entry-recall gap, every one of them reachable only through a code-pointer word
that `aif::code_pointer_table_seeds` already finds and then throws away.

The shipped Stage-3 scan requires a pointer's target to open with a Thumb
stack-frame prologue and to disassemble into more than two instructions. On
bare-metal firmware that is the wrong population: 93.3% of the missed entries
establish no frame at all and 41% are <= 8-byte leaves (`movs r0,#0; bx lr`, or a
bare `bx lr`, which is a valid Cortex-M exception handler every rival recovers).
Those two predicates reject 1,632 of the 1,671.

Deleting them is not shippable - the proposal measured the naive relaxation at 62%
ground truth with 21% of the new entries splitting a real function body, a failure
mode decbench structurally cannot see. So the whole of this change is the precision
model, and the model is CONTAINMENT rather than shape: reject a target when any
word that references it overlaps a decoded instruction (it is operand bytes, not a
table slot) or lies in the same discovered function as the target itself (that
pairing IS the `ldr pc,[pc,r]` switch table). Measured over 3,462 validated
candidates the two guards take splits from 1,261 to 0 for 17 ground-truth entries.
The `MIN_SUBROUTINE_INSNS` floor is replaced, not deleted, by a terminating-routine
check: the same speculative walk with the strict escape policy and no minimum
length.

This is kuna's form of the line Ghidra draws between `OperandReferenceAnalyzer`
(creates functions, from instruction operands) and `DataOperandReferenceAnalyzer`,
which overrides `createFunctions` to a no-op - "don't ever create a function from a
data pointer". kuna cannot use Ghidra's version directly because the Listing tier
records only control-flow references, so the containment pair recovers the same
discrimination from the code/data partition the walk leaves behind.

Measured on the 48-image decbench Cortex-M corpus (41,378 DWARF ground-truth
addresses), `kuna functions`:

  recall 38,238 (92.4%) -> 39,851 (96.3%), +1,613
  1,694 new entries, 1,613 ground truth (95.2%)
  0 splitting a real function body, 81 outside any DWARF body
  0 entries lost, 0 ground-truth entries lost

`--option listing off` is structurally inert (ptrentry is a Listing consumer): 0
new, 0 lost. Whole-binary `decompile-all --json` is sha256-identical off vs on for
x86-64, ARM Linux and the Cortex-M images with no admissible candidate.

Two things the proposal asked for that measurement rejected, both built and
measured rather than argued (tables in docs/features/ptrentry/):

  - table-run corroboration: a switch table IS a run, so it removes no additional
    split, and it costs 311 ground-truth functions (1,302 vs 1,613);
  - re-seeding the recursive-descent walk (what Stages 2-3 do): +13 ground-truth
    entries but 974 split bodies and 734 dropped entries, through the same
    tail-call absorption that constrained step 1. The pass therefore emits entry
    facts only, which makes "never removes an entry" a property of the wiring
    rather than of a heuristic. That also settles the proposal's optional AIF
    gap-start re-walk fold-in: closing it IS a walk re-seed, so it stays with
    step 3.

Default-OFF and not auto-injected by any driver: it discovers more functions, so it
changes emitted C by construction, and the precision numbers want a human read
before a flip. No DIV row (default output is byte-identical).

Tests: `kuna-console/tests/verify_ptrentry.rs` is the two-pass e2e over a new
hand-assembled fixture carrying both shapes - the pointer-only leaf that must be
recovered and the switch-table case that must stay rejected with the option ON -
plus three unit tests and a superset-property pin. No `tests/stages/*.xml`: the
harness embeds raw `<bytechunk>`s and never builds a load image or a Listing, the
same reason every sibling analysis-tier discovery flag ships a cross-crate
`verify_*` gate.

Gates on the rebased tree (origin/main 208bb15, after #252/#253/#254): make test
PARITY OK 675/675; make test-stages PARITY OK 386/386; make rust-test green
(295/295 result blocks); make check-spec green in strict mode; kuna catalog
--check OK.

Every shared counter is derived from a fresh `phase catalog` capture and a green
run on the rebased tree, not by arithmetic: settables 87 -> 88, analysis tier
26 -> 27, catalog JSON rows 86 -> 87, bytecompat fixture 87 -> 88, and the
live-value count stays at 29 because this row declares no codegen live_field.
The `kuna-base/src/xml.rs` corpus count was verified by counting the files (83
datatests + 107 stages = 190, unchanged), and `docs/baseline-stages.json` is
untouched because this PR adds no stages XML. The recall/precision table and the
off-vs-on sha256 ablation were re-measured on the rebased build and are
unchanged, with 0 of 48 per-binary entry sets differing from the pre-rebase run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…n entries on containment evidence (#255)

Step 2 of the approved ARM entry-recall sequence ([PROPOSAL] #239) and the one it
called the prize: 1,671 missed function entries, 56.8% of the whole ARM
entry-recall gap, every one of them reachable only through a code-pointer word
that `aif::code_pointer_table_seeds` already finds and then throws away.

The shipped Stage-3 scan requires a pointer's target to open with a Thumb
stack-frame prologue and to disassemble into more than two instructions. On
bare-metal firmware that is the wrong population: 93.3% of the missed entries
establish no frame at all and 41% are <= 8-byte leaves (`movs r0,#0; bx lr`, or a
bare `bx lr`, which is a valid Cortex-M exception handler every rival recovers).
Those two predicates reject 1,632 of the 1,671.

Deleting them is not shippable - the proposal measured the naive relaxation at 62%
ground truth with 21% of the new entries splitting a real function body, a failure
mode decbench structurally cannot see. So the whole of this change is the precision
model, and the model is CONTAINMENT rather than shape: reject a target when any
word that references it overlaps a decoded instruction (it is operand bytes, not a
table slot) or lies in the same discovered function as the target itself (that
pairing IS the `ldr pc,[pc,r]` switch table). Measured over 3,462 validated
candidates the two guards take splits from 1,261 to 0 for 17 ground-truth entries.
The `MIN_SUBROUTINE_INSNS` floor is replaced, not deleted, by a terminating-routine
check: the same speculative walk with the strict escape policy and no minimum
length.

This is kuna's form of the line Ghidra draws between `OperandReferenceAnalyzer`
(creates functions, from instruction operands) and `DataOperandReferenceAnalyzer`,
which overrides `createFunctions` to a no-op - "don't ever create a function from a
data pointer". kuna cannot use Ghidra's version directly because the Listing tier
records only control-flow references, so the containment pair recovers the same
discrimination from the code/data partition the walk leaves behind.

Measured on the 48-image decbench Cortex-M corpus (41,378 DWARF ground-truth
addresses), `kuna functions`:

  recall 38,238 (92.4%) -> 39,851 (96.3%), +1,613
  1,694 new entries, 1,613 ground truth (95.2%)
  0 splitting a real function body, 81 outside any DWARF body
  0 entries lost, 0 ground-truth entries lost

`--option listing off` is structurally inert (ptrentry is a Listing consumer): 0
new, 0 lost. Whole-binary `decompile-all --json` is sha256-identical off vs on for
x86-64, ARM Linux and the Cortex-M images with no admissible candidate.

Two things the proposal asked for that measurement rejected, both built and
measured rather than argued (tables in docs/features/ptrentry/):

  - table-run corroboration: a switch table IS a run, so it removes no additional
    split, and it costs 311 ground-truth functions (1,302 vs 1,613);
  - re-seeding the recursive-descent walk (what Stages 2-3 do): +13 ground-truth
    entries but 974 split bodies and 734 dropped entries, through the same
    tail-call absorption that constrained step 1. The pass therefore emits entry
    facts only, which makes "never removes an entry" a property of the wiring
    rather than of a heuristic. That also settles the proposal's optional AIF
    gap-start re-walk fold-in: closing it IS a walk re-seed, so it stays with
    step 3.

Default-OFF and not auto-injected by any driver: it discovers more functions, so it
changes emitted C by construction, and the precision numbers want a human read
before a flip. No DIV row (default output is byte-identical).

Tests: `kuna-console/tests/verify_ptrentry.rs` is the two-pass e2e over a new
hand-assembled fixture carrying both shapes - the pointer-only leaf that must be
recovered and the switch-table case that must stay rejected with the option ON -
plus three unit tests and a superset-property pin. No `tests/stages/*.xml`: the
harness embeds raw `<bytechunk>`s and never builds a load image or a Listing, the
same reason every sibling analysis-tier discovery flag ships a cross-crate
`verify_*` gate.

Gates on the rebased tree (origin/main 208bb15, after #252/#253/#254): make test
PARITY OK 675/675; make test-stages PARITY OK 386/386; make rust-test green
(295/295 result blocks); make check-spec green in strict mode; kuna catalog
--check OK.

Every shared counter is derived from a fresh `phase catalog` capture and a green
run on the rebased tree, not by arithmetic: settables 87 -> 88, analysis tier
26 -> 27, catalog JSON rows 86 -> 87, bytecompat fixture 87 -> 88, and the
live-value count stays at 29 because this row declares no codegen live_field.
The `kuna-base/src/xml.rs` corpus count was verified by counting the files (83
datatests + 107 stages = 190, unchanged), and `docs/baseline-stages.json` is
untouched because this PR adds no stages XML. The recall/precision table and the
off-vs-on sha256 ablation were re-measured on the rebased build and are
unchanged, with 0 of 48 per-binary entry sets differing from the pre-rebase run.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round

Docs-only. No .rs, no phases.toml, no baselines, no tests.

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis: #248 cortexmvectors, #249 funcptralign,
  #250 paramcopyhoist, #251 subright, #252 returncopysplit, #253 itecondlist
  (merged) and #254 peimportcall (IN FLIGHT), each with its measured effect.
- Named the structural finding that outlives them: three separate ported passes
  were dead -- RuleSubRight (stub body), RuleFuncPtrEncoding (live body, stubbed
  input) and ActionDeindirect (live body, a gate bit set nowhere). Each was
  invisible to every test and each had large breadth, so "grep for
  registered-but-unreachable passes" is now a mining route of its own.
- Carried forward what did not ship: undefname-leak (283 functions, 221 with
  uninitialised reads) and catalog-upstream-options (38 upstream-inherited
  ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates: make check-spec OK (lenient and strict); make test 675/675 PARITY OK;
make test-stages 381/381 PARITY OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round

Docs-only. No .rs, no phases.toml, no baselines, no tests.
Rebased onto origin/main 4c2b59b (after #254, #255 and #257).

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

Shared counters in a busy queue (decbench-loop.md + improvement-pipeline.md)
- Round 2 ran up to four output-changing PRs over the same hard-coded counters
  and produced three failure shapes, only one of which announced itself: a
  conflict (#257's DIV number raced 55 -> 56 -> 57 -> 58); a SILENT
  identical-edit auto-merge (catalog_bytecompat.rs kept 86 because both sides
  made the same 85 -> 86 edit); and a SILENT keep-both auto-merge (a stale
  baseline-stages.json data_footer, and five rounds of keep-both duplicating a
  row in tests/stages/README.md).
- Rules written down: derive every shared counter from a fresh capture and a
  green run on the rebased tree, never by arithmetic; diff every keep-both
  resolution against main asserting you removed nothing and added nothing twice;
  DIV numbers are claimed on merge; re-run the gates AFTER the rebase.
- New standing requirement 9: re-measure after every rebase, never carry a
  number forward. #257's placeholder count moved 2,143 -> 2,142 because #254
  landed underneath it, caught only by re-measuring.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis. NINE merged PRs: #248 cortexmvectors,
  #249 funcptralign, #250 paramcopyhoist, #251 subright, #252 returncopysplit,
  #253 itecondlist, #254 peimportcall (DIV-57), #255 ptrentry and #257 undefname
  (DIV-58) -- seven of the eight round-2 candidates plus steps 1 and 2 of the
  ARM entry-recall sequence (#239). Only three of the nine move GED on a mined
  case; four are correctness fixes the metric cannot see and two are recall.
- The dead-pass finding is now three DISTINCT shapes to grep for, not one
  anecdote: stub body (RuleSubRight), live body with a permanently-zero input
  (RuleFuncPtrEncoding's hard-coded funcptr_align() = 0), and live body with a
  gate bit that has no writer anywhere (ActionDeindirect / externref). The third
  had a second gap in the same chain -- GlobalEntry::func_no_return never copied
  the callee's no-return flag into the snapshot -- so one dead gate can hide
  another.
- The ARM sequence is cross-referenced to the live table on PR #239 rather than
  duplicated here, so it cannot go stale in-repo.
- Carried forward as the one still-open candidate: catalog-upstream-options
  (38 upstream-inherited ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates on the rebased base: make check-spec OK (lenient and strict);
make test 675/675 PARITY OK; make test-stages 394/394 PARITY OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round (#256)

Docs-only. No .rs, no phases.toml, no baselines, no tests.
Rebased onto origin/main 4c2b59b (after #254, #255 and #257).

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

Shared counters in a busy queue (decbench-loop.md + improvement-pipeline.md)
- Round 2 ran up to four output-changing PRs over the same hard-coded counters
  and produced three failure shapes, only one of which announced itself: a
  conflict (#257's DIV number raced 55 -> 56 -> 57 -> 58); a SILENT
  identical-edit auto-merge (catalog_bytecompat.rs kept 86 because both sides
  made the same 85 -> 86 edit); and a SILENT keep-both auto-merge (a stale
  baseline-stages.json data_footer, and five rounds of keep-both duplicating a
  row in tests/stages/README.md).
- Rules written down: derive every shared counter from a fresh capture and a
  green run on the rebased tree, never by arithmetic; diff every keep-both
  resolution against main asserting you removed nothing and added nothing twice;
  DIV numbers are claimed on merge; re-run the gates AFTER the rebase.
- New standing requirement 9: re-measure after every rebase, never carry a
  number forward. #257's placeholder count moved 2,143 -> 2,142 because #254
  landed underneath it, caught only by re-measuring.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis. NINE merged PRs: #248 cortexmvectors,
  #249 funcptralign, #250 paramcopyhoist, #251 subright, #252 returncopysplit,
  #253 itecondlist, #254 peimportcall (DIV-57), #255 ptrentry and #257 undefname
  (DIV-58) -- seven of the eight round-2 candidates plus steps 1 and 2 of the
  ARM entry-recall sequence (#239). Only three of the nine move GED on a mined
  case; four are correctness fixes the metric cannot see and two are recall.
- The dead-pass finding is now three DISTINCT shapes to grep for, not one
  anecdote: stub body (RuleSubRight), live body with a permanently-zero input
  (RuleFuncPtrEncoding's hard-coded funcptr_align() = 0), and live body with a
  gate bit that has no writer anywhere (ActionDeindirect / externref). The third
  had a second gap in the same chain -- GlobalEntry::func_no_return never copied
  the callee's no-return flag into the snapshot -- so one dead gate can hide
  another.
- The ARM sequence is cross-referenced to the live table on PR #239 rather than
  duplicated here, so it cannot go stale in-repo.
- Carried forward as the one still-open candidate: catalog-upstream-options
  (38 upstream-inherited ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates on the rebased base: make check-spec OK (lenient and strict);
make test 675/675 PARITY OK; make test-stages 394/394 PARITY OK.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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