Skip to content

[AUTOMATED] feat(p1): tailcallentry - recover the function entries the Listing walk absorbs at a tail call (+561 at 94.6%) - #259

Merged
mahaloz merged 1 commit into
mainfrom
feat/decbench-tailcallentry
Aug 3, 2026
Merged

mahaloz merged 1 commit into
mainfrom
feat/decbench-tailcallentry

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Acceptance table — read this first

Step 3 of the approved ARM entry-recall sequence ([PROPOSAL] #239) is the step
that proposal flagged as carrying the real precision risk: its measured naive arm
was 39% ground truth with 55% of the new entries splitting a real function
body
, and its "stricter" variant 54%/38%. The bar was ≥ 80% ground truth and
zero entries lost
.

Corpus: every ARM Cortex-M image the three decbench optimisation trees carry —
8 projects × 3 levels = 96 images, 43,809 DWARF ground-truth addresses, run
against the stripped binaries with ground truth from the matching
compiled/ counterparts.

surface ground truth recall before recall after new entries of which GT splits a real body outside any DWARF body entries lost
kuna functions --mode aggressive 43,809 40,309 (92.0%) 40,870 (93.3%) 593 561 (94.6%) 0 32 0
stacked on --option ptrentry on (#255) 43,809 42,028 (95.9%) 42,589 (97.2%) 593 561 (94.6%) 0 32 0
--option listing off 43,809 13,277 13,277 0 — 0 0 0

+561 recovered ground-truth functions at 94.6% precision, zero split bodies,
zero losses.

One disclosed non-zero-split number: u-boot (ARM Linux, A32) is in scope —
the gate is Architecture::Arm, the same one Stages 2 and 3 use — and is not
byte-identical with the option on: +21 entries, 19 ground truth (90.5%), 2
split a real body
, 0 lost. It clears the bar on a population the model was
never fitted on (A32 not Thumb, Linux not bare metal), but it is the one place
the zero-split result does not hold. Left as measured rather than gated away;
see analysis.md §8 for why a length floor is the wrong fix.


The gap

listing/walk.rs makes a new function entry at a CALL target and treats every
other flow target as a same-function successor
. A routine reached only by a
tail B is therefore swallowed by whichever function branched to it and never
becomes a function at all — 513 missed entries, 17.4% of the ARM entry-recall
gap, and the blocker both shipped predecessors ran into independently (step 1
lost 54 ground-truth entries to it; step 2 measured a walk-reseed wiring at 734
lost entries and 974 split bodies and shipped an additive one instead).

Two results got past the 39% naive arm

1. The split cannot change what the walk decodes. Write the walk as its
closure: every function entry is decoded, so F ⊆ I. Moving a tail-call target
from the instruction worklist to the function worklist therefore leaves the
decoded-instruction set fixed and only grows the function set. Two
consequences: the split can be computed after the walk, with complete
predecessor and region information instead of whatever the LIFO worklist order
happened to expose (the obvious in-walk test — "is the target already claimed by
this function?" — is order-dependent and answers "no" for every forward branch);
and because the Listing is never rebuilt, "never removes an entry" is a
property of the wiring
, so the 0-lost column is a structural fact rather than a
lucky number.

2. Containment is region crossing. A target is admitted only when

  1. every predecessor is an unconditional branch (a fall-through or
    conditional-branch predecessor means the caller's straight-line code runs into
    it — ordinary intra-function flow);
  2. the branch leaves the caller's entry-ordered function region, i.e. at
    least one other discovered entry lies between the branch and its target;
  3. the target's flow region reaches a RETURN or a computed jump (terminating
    -routine validity, no length floor — a one-instruction bx lr handler
    qualifies);
  4. the target does not open with a stack restore (a function does not begin by
    tearing down a frame it never built — that shape is the caller's shared
    epilogue).

Leave-one-out over the full corpus:

drop new ground truth splits
— (shipped) 593 561 (94.6%) 0
the region crossing 1274 656 (51.5%) 514
the pure-predecessor test 790 562 (71.1%) 156
the epilogue-start test 605 561 (92.7%) 12
the terminating-region test 615 568 (92.4%) 0

The region crossing is the containment fact the proposal asked for, and it is the
mirror of ptrentry's decisive guard: ptrentry rejects a pointer whose
referencing word sits in the same discovered region as its target; this rejects
a branch that never leaves its own region.

Two alternatives were built and measured, and are not shipped

model new ground truth splits why not
stack discipline (reject a branch taken with an unmatched PUSH/SUB SP open) 636 572 (89.9%) 18 dominated by region containment on precision and on splits
shipped + inter-function alignment padding 390 375 (96.2%) 0 1.6pp of precision for 186 ground-truth functions

The stack-discipline model is where this work started, and it is the principled
one; measurement said region containment beats it on both axes. Same shape as
step 2 discarding table-run corroboration.

It is not curve-fitted

The four guards were chosen from a pool of 22 candidate features, so a split-half
holdout was run over the eight projects. The shipped rule scores 99.2% with
zero splits on the held-out half
(93.3% / 0 on the fit half). Per project it
ranges 90.3%–100.0% and per optimisation level 85.7% (O0) – 96.8% (O2-noinline),
with zero split bodies in every cell.

What comes back

Real functions, not fragments. Three consecutive nuttx O2 recoveries, with
their DWARF names: up_irqinitialize (0x8000b04, NVIC init — seven MMIO stores
and a priority-table loop), up_trigger_irq (0x8000d3c, a four-arm switch with
three tail calls), board_autoled_initialize (0x8000e94). None of them
previously produced a function of its own.

The AIF gap-start re-walk is NOT folded in (measured)

Step 2 assigned this here. Implemented on this branch (reverted; not in the diff)
and measured over the same 96 images:

recall delta new of which GT splits entries LOST of which GT
re-walk, tailcallentry off +87 1355 174 1013 109 87
re-walk, tailcallentry on +86 1424 193 1059 135 107

The tail-call split does not make it safe — it makes it slightly worse, and the
closure argument above says why: a split leaves the decoded-instruction closure
fixed, a re-seed adds to it, turning undefined gaps into code and making other
stages' candidates fail their is_undefined guard. It needs its own
investigation.

Ship shape

  • Default-OFF, ARM-gated like the sibling Stage-2/3 seed scans. phases.toml
    row with every field populated, inspiration prefixed decbench:, registered
    in options.rs, kuna catalog --check OK.
  • Strict no-op elsewhere: whole-binary decompile-all --json is sha256
    -identical off vs on for gzip (x86-64), mydoom.exe (PE — relevant after
    [AUTOMATED] feat(p1): peimportcall - bind a Windows call [IAT slot] to its import (DIV-57) #254 changed PE flow termination), and the Cortex-M images with no admissible
    candidate. The XML datatest path never builds a Listing, so the option cannot
    fire there at all.
  • Speed: interleaved off/on pairs, minimum reported (shared box). Every
    kuna functions delta is inside the ±0.21% strict-no-op floor on images from
    140 ms to 5.0 s; the decompile-all deltas are the extra decompile work for
    the extra functions and are sub-proportional to it (chibios +67 functions of
    620 = +10.8% work for +1.92% wall clock).
  • Tests: unit tests for the region lookup, the containment predicate in both
    directions and the epilogue matcher; a 4-test cross-crate e2e
    (verify_tailcallentry.rs) over a new 437-byte hand-assembled fixture carrying
    one genuine tail call plus the three near-miss shapes — all four reached only
    by an unconditional B, so the naive rule takes every one and the containment
    model takes exactly one. No tests/stages/*.xml: the pass reads the Listing
    tier, which the datatest harness never constructs, the same reason every
    sibling analysis-tier discovery flag ships a verify_* gate.
  • Catalog counts re-derived from a fresh phase catalog capture on the
    rebased tree, not by arithmetic (settables 88→89, analysis tier 27→28, JSON
    rows 87→88, bytecompat fixture 88→89). The rebase onto merged ptrentry
    produced a real conflict on the two count comments rather than a silent stale
    value; both were resolved to base + both.
  • No DIV row — default output is byte-identical.

Gates

make test PARITY OK 675/675 · make test-stages PARITY OK 394/394 (no
baseline re-record) · make rust-test green · make check-spec green (lenient
and strict) · kuna catalog --check OK.

Bundle: docs/features/tailcallentry/{analysis.md,plan.md,record.json,measurements.txt}.

🤖 Generated with Claude Code

https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

…e Listing walk absorbs at a tail call (+561 at 94.6%)

Step 3 of the approved ARM entry-recall sequence (PROPOSAL PR #239), and the step
both shipped predecessors independently found blocking them: `listing/walk.rs`
makes a new function only at a CALL target and treats every other flow target as
a same-function successor, so a routine reached only by a tail `B` is swallowed
by whichever function branched to it and never becomes a function at all — 513
missed entries, 17.4% of the ARM entry-recall gap.

Measured on 96 ARM Cortex-M images (43,809 DWARF entries), `kuna functions
--mode aggressive`:

  entry recall 40,309 (92.0%) -> 40,870 (93.3%)
  593 new entries, 561 ground truth (94.6%), 0 split a real body,
  32 outside any DWARF body, 0 entries lost

The proposal's naive arm for this step was the worst-precision arm of the whole
sequence — 39% ground truth with 55% of the new entries splitting a real
function body — and its "stricter" variant 54%/38%. Neither was shippable.

Two results got past that.

1. The split cannot change what the walk decodes. Writing the walk as its
   closure, moving a tail-call target from the instruction worklist to the
   function worklist leaves the decoded-instruction set fixed, because a
   function entry is walked and therefore decoded either way. So the split is
   computed AFTER the walk, with complete predecessor and region information
   rather than whatever the LIFO worklist order exposed, and emitted as an
   additive entry fact that never rebuilds the Listing. "Never removes an entry"
   is a property of the wiring, not of a heuristic.

2. Containment is region crossing. A target is admitted only when every
   predecessor is an unconditional branch, the branch LEAVES the caller's
   entry-ordered function region, the target's flow region reaches a RETURN or
   computed jump (no length floor), and the target does not open with a stack
   restore. Leave-one-out says the region crossing is load-bearing: dropping it
   costs 43 points of precision and splits 514 real bodies. A stack-discipline
   model (reject a branch taken with an unmatched PUSH/SUB SP open) was built,
   measured at 89.9%/18 splits, and dominated; inter-function alignment padding
   was measured and declined at 186 ground-truth functions for 1.6pp.

Split-half holdout over the eight projects: the shipped rule scores 99.2% with
zero splits on the held-out half. Per project 90.3%-100.0%, per optimisation
level 85.7%-96.8%, zero split bodies in every cell.

Exactly orthogonal to `ptrentry` (#255): identical delta with it off and on,
because neither enters `Listing::functions()`. Stacked, corpus entry recall is
97.2%.

The AIF gap-start re-walk that step 2 assigned here is NOT folded in, and the
measurement says why: it is a walk re-seed, which ADDS to the decoded-instruction
closure and makes other stages' candidates fail their `is_undefined` guard —
109 entries lost, 87 of them ground truth, 1013 split bodies, and
`tailcallentry` makes it slightly worse rather than safe.

Default-OFF, ARM-gated. gzip (x86-64) and mydoom.exe (PE) are byte-identical
off vs on. u-boot (ARM Linux, A32) is in scope and disclosed: +21 entries, 19
ground truth (90.5%), 2 splits, 0 lost — the one non-zero-split number, on a
population the model was never fitted on.

Bundle: docs/features/tailcallentry/. Gates: make test 675/675 PARITY OK,
make test-stages 394/394 PARITY OK, make rust-test green, make check-spec green
(strict), kuna catalog --check OK. No DIV row (default output byte-identical).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
@mahaloz
mahaloz merged commit 57351a6 into main Aug 3, 2026
9 checks passed
@mahaloz
mahaloz deleted the feat/decbench-tailcallentry branch August 3, 2026 15:24
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-60) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on five binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 1cff8ec (#262, cppcallnames, DIV-59) and fully re-measured on that
tree: the C corpus, the C++ probes, the ARM corpus and every catalog counter
reproduce exactly. Both arms of every off/on comparison are the same build, so
#262's C++ callee renaming cancels; the added surviving_names_changed /
NAMED_LOST counters are 0 everywhere, so no entry this option removes was
shadowing a real symbol. phase_catalog.json re-captured and docs/options.md
regenerated from the post-rebase build; no stages XML added, so no corpus count
or stages baseline moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-60) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on five binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 1cff8ec (#262, cppcallnames, DIV-59) and fully re-measured on that
tree: the C corpus, the C++ probes, the ARM corpus and every catalog counter
reproduce exactly. Both arms of every off/on comparison are the same build, so
#262's C++ callee renaming cancels; the added surviving_names_changed /
NAMED_LOST counters are 0 everywhere, so no entry this option removes was
shadowing a real symbol. phase_catalog.json re-captured and docs/options.md
regenerated from the post-rebase build; no stages XML added, so no corpus count
or stages baseline moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-61) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on eight binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 890096b (#264 cppproto, DIV-60) on 1cff8ec (#262 cppcallnames,
DIV-59), and fully re-measured on that tree rather than carried forward, because
neither is inert here. #264 recovers out-of-line C++ member and namespace
definitions from DWARF, so an unstripped C++ binary now carries far more named
function symbols - the input to this option's "range holds no other named
function start" condition. The invariant holds against the new symbol set:
big_O0 now has 447 of its 450 surviving entries named (probe_O0 161 of 163) and
the filter still drops 150 with 0 real and 0 named lost, while the stripped
counterparts are unchanged at 449 / 162 (verified, not assumed - no DWARF there).
Both arms of every comparison are the same build, so #262's renaming and #264's
MAX_TYPE_DEPTH change cancel; coreutils fmt, the binary #264 altered, was
decompiled whole in both arms to keep the two unconflated (198 -> 191 entries, 0
surviving bodies changed; fmt-O2 151 -> 151).

Catalog counters were DERIVED from a fresh post-rebase catalog capture, not
incremented: 91 settables, 20 core / 41 transform / 30 analysis, 90 catalog rows.
#264 and this PR had made an identical off-by-one edit to the same three
assertions, so the merge resolution would have shipped the wrong number had it
been trusted. phase_catalog.json re-captured and docs/options.md regenerated from
the post-rebase build; no stages XML added, so no corpus count or stages baseline
moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-61) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on eight binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 890096b (#264 cppproto, DIV-60) on 1cff8ec (#262 cppcallnames,
DIV-59), and fully re-measured on that tree rather than carried forward, because
neither is inert here. #264 recovers out-of-line C++ member and namespace
definitions from DWARF, so an unstripped C++ binary now carries far more named
function symbols - the input to this option's "range holds no other named
function start" condition. The invariant holds against the new symbol set:
big_O0 now has 447 of its 450 surviving entries named (probe_O0 161 of 163) and
the filter still drops 150 with 0 real and 0 named lost, while the stripped
counterparts are unchanged at 449 / 162 (verified, not assumed - no DWARF there).
Both arms of every comparison are the same build, so #262's renaming and #264's
MAX_TYPE_DEPTH change cancel; coreutils fmt, the binary #264 altered, was
decompiled whole in both arms to keep the two unconflated (198 -> 191 entries, 0
surviving bodies changed; fmt-O2 151 -> 151).

Catalog counters were DERIVED from a fresh post-rebase catalog capture, not
incremented: 91 settables, 20 core / 41 transform / 30 analysis, 90 catalog rows.
#264 and this PR had made an identical off-by-one edit to the same three
assertions, so the merge resolution would have shipped the wrong number had it
been trusted. phase_catalog.json re-captured and docs/options.md regenerated from
the post-rebase build; no stages XML added, so no corpus count or stages baseline
moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost) (#263)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-61) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on eight binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 890096b (#264 cppproto, DIV-60) on 1cff8ec (#262 cppcallnames,
DIV-59), and fully re-measured on that tree rather than carried forward, because
neither is inert here. #264 recovers out-of-line C++ member and namespace
definitions from DWARF, so an unstripped C++ binary now carries far more named
function symbols - the input to this option's "range holds no other named
function start" condition. The invariant holds against the new symbol set:
big_O0 now has 447 of its 450 surviving entries named (probe_O0 161 of 163) and
the filter still drops 150 with 0 real and 0 named lost, while the stripped
counterparts are unchanged at 449 / 162 (verified, not assumed - no DWARF there).
Both arms of every comparison are the same build, so #262's renaming and #264's
MAX_TYPE_DEPTH change cancel; coreutils fmt, the binary #264 altered, was
decompiled whole in both arms to keep the two unconflated (198 -> 191 entries, 0
surviving bodies changed; fmt-O2 151 -> 151).

Catalog counters were DERIVED from a fresh post-rebase catalog capture, not
incremented: 91 settables, 20 core / 41 transform / 30 analysis, 90 catalog rows.
#264 and this PR had made an identical off-by-one edit to the same three
assertions, so the merge resolution would have shipped the wrong number had it
been trusted. phase_catalog.json re-captured and docs/options.md regenerated from
the post-rebase build; no stages XML added, so no corpus count or stages baseline
moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).


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

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

cortexmvectors (#248), ptrentry (#255), tailcallentry (#259) and poolentry (#278)
all shipped default-OFF and sat on the UNEVALUATED list in modes.rs, so they were
absent from AGGRESSIVE_OVERRIDES. `auto` resolves to `aggressive` under 500 KiB,
and the preset is what the whole-binary surfaces actually run, so all four were
INERT on every default path -- the DIV-64 itaniumrtti trap, four times over. The
default path's stripped-ARM entry recall had not moved since they merged.

They are flipped jointly because they compose, which is exactly what the
UNEVALUATED comment demanded before any flip.

Measured over the 110 stripped non-x86-64 decbench twins against their unstripped
twins' symbol tables (50,724 ground-truth function starts), --mode aggressive:

  arm       entries   exact   midbody   recall     added  added_exact  lost_exact
  base        55006   44957      8333   88.63%         -            -           -
  cortexm     55142   45093      8333   88.90%       136          136           0
  ptr         56594   46522      8333   91.72%      1588         1565           0
  tail        55655   45602      8337   89.90%       649          645           0
  pool        53956   45122      7116   88.96%       167          165           0
  all4        56188   47330      7117   93.31%      2402         2373           0

Recall and precision improve together: +2,373 real entries (98.8% of everything
added is a real function start) while mid-body false entries FALL 8,333 -> 7,117.
No ground-truth entry is lost by any arm -- poolentry's 1,217 removals contain
zero ground-truth addresses. 0 of 110 binaries lose recall.

Restricted to the 105 binaries `auto` actually sends to `aggressive` (< 500 KiB),
the default-path number is 90.92% -> 96.06%. The 5 images at/over the threshold
resolve to `reliable` and are disclosed in the DIV row rather than papered over.

Non-ARM inertness is measured: identical entry sets over 90 x86-64 twins and the
12 i386 PE images in the ARM corpus, byte-identical emitted C over 8 x86-64
binaries. Speed, interleaved min-of-4: decompile-all cf2.elf -5.8% (a speedup),
nuttx +3.5%, x86-64 controls at noise; discovery-only `kuna functions` +6.2%,
which is more work for more output on the one surface that only does discovery.

The 0/675 ablation is proven, not asserted: a throwaway build with all four forced
ON as engine defaults -- strictly stronger than preset membership, which the XML
harness never applies -- still reports 675/675 and 538/538 PARITY OK.

Also lands PR #239's two doc corrections, repointed at the shipped feature docs
rather than at its unshipped-proposal directory: the recall-measurement.md
mechanism/noise correction and the missing-ghidra-analyses.md
OperandReferenceAnalyzer row (its "function creation is subsumed by entry-disc"
claim is what ptrentry disproved).

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1
mahaloz added a commit that referenced this pull request Aug 27, 2026
…e aggressive preset (DIV-93) (#345)

* feat(modes): the four ARM entry-discovery options join the aggressive preset (DIV-90)

cortexmvectors (#248), ptrentry (#255), tailcallentry (#259) and poolentry (#278)
all shipped default-OFF and sat on the UNEVALUATED list in modes.rs, so they were
absent from AGGRESSIVE_OVERRIDES. `auto` resolves to `aggressive` under 500 KiB,
and the preset is what the whole-binary surfaces actually run, so all four were
INERT on every default path -- the DIV-64 itaniumrtti trap, four times over. The
default path's stripped-ARM entry recall had not moved since they merged.

They are flipped jointly because they compose, which is exactly what the
UNEVALUATED comment demanded before any flip.

Measured over the 110 stripped non-x86-64 decbench twins against their unstripped
twins' symbol tables (50,724 ground-truth function starts), --mode aggressive:

  arm       entries   exact   midbody   recall     added  added_exact  lost_exact
  base        55006   44957      8333   88.63%         -            -           -
  cortexm     55142   45093      8333   88.90%       136          136           0
  ptr         56594   46522      8333   91.72%      1588         1565           0
  tail        55655   45602      8337   89.90%       649          645           0
  pool        53956   45122      7116   88.96%       167          165           0
  all4        56188   47330      7117   93.31%      2402         2373           0

Recall and precision improve together: +2,373 real entries (98.8% of everything
added is a real function start) while mid-body false entries FALL 8,333 -> 7,117.
No ground-truth entry is lost by any arm -- poolentry's 1,217 removals contain
zero ground-truth addresses. 0 of 110 binaries lose recall.

Restricted to the 105 binaries `auto` actually sends to `aggressive` (< 500 KiB),
the default-path number is 90.92% -> 96.06%. The 5 images at/over the threshold
resolve to `reliable` and are disclosed in the DIV row rather than papered over.

Non-ARM inertness is measured: identical entry sets over 90 x86-64 twins and the
12 i386 PE images in the ARM corpus, byte-identical emitted C over 8 x86-64
binaries. Speed, interleaved min-of-4: decompile-all cf2.elf -5.8% (a speedup),
nuttx +3.5%, x86-64 controls at noise; discovery-only `kuna functions` +6.2%,
which is more work for more output on the one surface that only does discovery.

The 0/675 ablation is proven, not asserted: a throwaway build with all four forced
ON as engine defaults -- strictly stronger than preset membership, which the XML
harness never applies -- still reports 675/675 and 538/538 PARITY OK.

Also lands PR #239's two doc corrections, repointed at the shipped feature docs
rather than at its unshipped-proposal directory: the recall-measurement.md
mechanism/noise correction and the missing-ghidra-analyses.md
OperandReferenceAnalyzer row (its "function creation is subsumed by entry-disc"
claim is what ptrentry disproved).

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs(decbench): retire the two round-ledger claims DIV-90 falsifies

features-round4.md Rank 6 was a filed, still-open recommendation to flip
`tailcallentry` into the preset ("aggressive does not carry it"); DIV-90 does
exactly that, so it is marked SHIPPED with the sweep it asked for. features.md
still called step 3 "in flight" and did not know about step 5 (`poolentry`, #278).

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs: state the ARM restriction precisely -- poolentry has no arch gate

cortexmvectors/ptrentry/tailcallentry each early-return on
`object::Architecture::Arm`; poolentry does not, and is ARM-only in EFFECT
because it keys on PC-relative literal pools. The measured inertness is the same
either way (identical entry sets on 90 x86-64 twins and 12 i386 PE images), but
"all four are ARM-gated" overstated the mechanism for one of them.

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs(history): add the leave-one-out direction to the DIV-90 evidence

Dropping each option from the combination loses 27 / 1427 / 645 / 136 ground-truth
entries respectively, and dropping poolentry is the only one that also raises
mid-body false entries (7117 -> 8337). No option is redundant given the others.

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs: renumber the ARM-preset divergence to DIV-93

[AUTOMATED] DIV-90/91/92 were claimed by #341/#342/#344 while this branch was
in flight; the row and every reference move to DIV-93.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

---------

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