Skip to content

[AUTOMATED] feat(modes): the four ARM entry-discovery options join the aggressive preset (DIV-93) - #345

Merged
mahaloz merged 5 commits into
mainfrom
feat/armentrypreset
Aug 27, 2026
Merged

mahaloz merged 5 commits into
mainfrom
feat/armentrypreset

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

The defect

cortexmvectors (#248), ptrentry (#255), tailcallentry (#259) and poolentry (#278) all
shipped default-OFF and sat on the UNEVALUATED list in
p0_knowledge/modes.rs, which exempted them from AGGRESSIVE_OVERRIDES. auto resolves to
aggressive under 500 KiB, and the preset is what decompile-all, functions,
decompile-project, the WASM front-end and the benchmark actually run — so all four were inert
on every default path
. decompile_all.rs injects only listing + funcstart_patterns + aif
on non-x86-64, so the only way to reach them was an explicit --option.

This is the DIV-64 itaniumrtti trap, four times over: the measurable consequence is that the
default path's stripped-ARM entry recall had not moved at all since the four passes merged.

The in-tree comment set the bar and this PR meets it verbatim — "Their preset membership is one
joint evaluation, not four."
They are flipped jointly because they compose (poolentry's
acceptance numbers were themselves measured on top of the other three).

Evidence

Corpus: the 110 stripped non-x86-64 decbench twins, scored against their unstripped twins'
symbol tables (STT_FUNC, Thumb bit masked) — 50,724 ground-truth function starts.
--mode aggressive, one frozen release binary for every arm.

arm entries exact midbody recall added added_exact lost_exact
base (today's default) 55006 44957 8333 88.63% – – –
cortexmvectors 55142 45093 8333 88.90% 136 136 (100.0%) 0
ptrentry 56594 46522 8333 91.72% 1588 1565 (98.6%) 0
tailcallentry 55655 45602 8337 89.90% 649 645 (99.4%) 0
poolentry 53956 45122 7116 88.96% 167 165 (98.8%) 0
all four 56188 47330 7117 93.31% 2402 2373 (98.8%) 0

Recall and precision improve together. +2,373 real entries and mid-body false entries
fall 8,333 → 7,117. This is not a recall-for-precision trade.

lost_exact (ground-truth entries dropped) is the metric this decision hinges on, and
scout-299's harness did not compute it — poolentry removes entries by design, so "never loses a
real entry" has to be proven per-address rather than inferred from a net total. It is 0 in every
arm
: poolentry's 1,217 removals contain zero ground-truth addresses.

  • 0 of 110 binaries lose recall. Exactly one (O2-noinline/u-boot) gains mid-body entries, +2.
  • Every ARM project gains: crazyflie +839, betaflight +523, cleanflight +263, libopencm3 +201,
    u-boot +173, chibios +162, nuttx +147, riot-os +43, freertos +22.

Both directions: leave-one-out from the combination

The table above adds each option to today's default. This one removes each from the
combination (reference = all four on) — the direction that actually answers "is any of these
redundant given the others?"

removed recall ground-truth entries lost midbody
— (all four) 93.31% – 7117
cortexmvectors off 93.26% 27 7117
ptrentry off 90.50% 1427 7120
tailcallentry off 92.04% 645 7113
poolentry off 93.04% 136 8337

None is redundant. poolentry is also the only one whose removal raises mid-body false
entries (7,117 → 8,337) — it carries the precision half of the pair. cortexmvectors is the
smallest contributor in context (+27, versus +136 measured alone, because the other three
independently reach most of what it unlocks), but it is never negative and costs nothing.

Non-ARM inertness — measured, not assumed

control result
90 x86-64 decbench twins, entry sets IDENTICAL (added 0, lost 0, every metric equal)
12 i386 PE images inside the ARM corpus IDENTICAL entry sets in all arms
decompile-all --json emitted C, 8 x86-64 binaries byte-identical (grep, sort, faillog, libselinux.so.1, du, id, wc, head)

Collateral on ARM (the point of the change)

decompile-all function counts: msc.elf 59 → 70, ch.elf 344 → 398, nuttx 727 → 792,
riot-os hello-world 151 → 171, betaflight 5013 → 5088, cf2.elf 1966 → 1973.

The new bodies are real. On msc.elf all 11 new entries are DWARF function starts
(ramdisk_write, usbd_register_control_callback, msc_control_request, dwc_ep_nak_set, …);
ch.elf 57/57, and its 3 removals are not ground truth. Sample, absent from the off arm:

// NEW at 0x8001a24 — DWARF name: dwc_ep_nak_set (verbatim kuna output)
void sub_8001a24(int a0,int a1,int a2) // return-dupe
{
  int v1; // r1
  int v2; // r3

  if (a1 << 0x18 <= -1)
    return;
  *(char *)(a0 + a1 + 0xec) = (char)a2;
  v1 = (a1 + 0x58) * 0x20;
  v2 = *(int *)(*(int *)(a0 + 0xdc) + 0x2c);
  if (!a2) {
    *(unsigned int *)(v1 + v2) = *(unsigned int *)(v1 + v2) | 0x4000000;
    return;
  }
  *(unsigned int *)(v1 + v2) = *(unsigned int *)(v1 + v2) | 0x8000000;
  return;
}

The two constants are the DWC-OTG DOEPCTL CNAK (bit 26) and SNAK (bit 27) flags, which
is precisely what a dwc_ep_nak_set(dev, ep, nak) routine should write.

Speed — interleaved, min-of-4, on a shared box (load 10–27)

surface off → on verdict
decompile-all cf2.elf (ARM) 37.42 → 35.23 s −5.8% (speedup) — retiring phantom bodies pays for the real ones
decompile-all nuttx (ARM) 9.03 → 9.35 s +3.5%, within budget (+65 functions)
decompile-all grep (x86-64) 15.40 → 15.39 s −0.1%, null as expected
functions libselinux.so.1 (x86-64) 0.47 → 0.50 s noise (medians equal at 0.68/0.69; emitted C byte-identical)
functions cf2.elf / betaflight (ARM) +6.2% / +6.6% over 5% on the discovery-only surface

Reported rather than buried: kuna functions does discovery and nothing else, so it is the worst
case by construction, and the extra time buys extra output (+7 and +75 functions). End to end,
where the surface actually costs something, the ARM number is a speedup or inside budget.

The 0/675 ablation — proven, not asserted

DIV-61/DIV-65 record that the XML <binaryimage> bootstrap never runs the analyzer tier, so this
should be structurally free. Rather than assert it, a throwaway build forced all four ON as
engine defaults — strictly stronger than preset membership, which the XML harness never
applies — and the corpus was re-run: 675/675 PARITY OK and 538/538 PARITY OK.

Disclosed caveat: the 500 KiB auto threshold

auto only picks aggressive below 500 KiB. On the 105 corpus binaries it actually reaches,
the default-path number is better than the aggregate: 90.92% → 96.06% (+1,677), mid-body
4,079 → 3,279. The 5 images at/over the threshold (2× u-boot, 3× betaflight) resolve to
reliable and get neither these four nor aifstrict, leaving +696 recoverable entries there.
--mode aggressive still delivers them, and the Ghidra front-end applies the preset
unconditionally, so it is unaffected. Raising or size-tiering that boundary is a separate DIV.

Also in this PR: PR #239's two doc corrections

Cherry-picked onto main and repointed at the shipped feature docs rather than at #239's
arm-entry-granularity/ directory, whose prose argues throughout that the fixes are unshipped:

  • docs/decbench/recall-measurement.md — the mechanism correction (it is not absorption:
    1,896 of 2,941 missed addresses sit past the end of the nearest kuna function and exactly 3 are
    inside a body) and the noise correction (the three bx lr handler stubs are real and every
    rival recovers them).
  • docs/missing-ghidra-analyses.md §6 — the OperandReferenceAnalyzer row. Its "function
    creation → subsumed by entry-disc" claim is exactly what ptrentry disproved; the row now reads
    🟡 with the shipped option named.

Do not merge #239's bundle as-is. Per the scout verdict, #239 should be closed with a comment
naming #248/#255/#259/#278 and this PR. Only its step 4 (TBB/TBH switch resolution) survives, and
it needs re-scoping from scratch — its estimate predates all four merged discovery passes.

Gates

gate result
make test datatests: 675/675 assertions passed → PARITY OK (docs/baseline.json untouched)
make test-stages datatests: 538/538 assertions passed → PARITY OK
make rust-test green — cargo test --workspace --no-fail-fast exit 0, 323 test binaries, 4834 passed, 0 failed, 0 ignored
make check-spec check-spec OK in both lenient and strict mode
kuna catalog --check catalog OK: documents exactly the registered kuna options

No new option, so no catalog count moved (119 settables, unchanged). One hard-coded fixture did
move and is re-derived from the failing assertion, not guessed:
kuna-decomp/tests/fixtures/phase_catalog.json (4 lines — the four options' use_when prose).
No tests/stages/*.xml added, so no corpus-count or baseline-stages re-record.

The regression gate for the flip is the existing invariant test
aggressive_carries_every_default_off_option: with the four removed from UNEVALUATED, dropping
any of them from the preset is now a build failure. A stage XML cannot cover this — the datatest
harness applies no mode at all, which is the same property that makes the 0/675 ablation free.

DIV number: claimed DIV-90 (highest on main is DIV-89). Sibling PRs may claim 90–94; if one
merges first this row and its references in modes.rs, docs/modes.md, docs/decbench-loop.md,
docs/missing-ghidra-analyses.md, docs/decbench/recall-measurement.md, phases.toml and
docs/options.md need renumbering.

🤖 Generated with Claude Code

https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

mahaloz and others added 5 commits August 27, 2026 19:59
… 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
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
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
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
[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
@mahaloz
mahaloz force-pushed the feat/armentrypreset branch from 1262815 to e93c346 Compare August 27, 2026 20:05
@mahaloz mahaloz changed the title [AUTOMATED] feat(modes): the four ARM entry-discovery options join the aggressive preset — 88.6% -> 93.3% entry recall, mid-body FALLS (DIV-90) [AUTOMATED] feat(modes): the four ARM entry-discovery options join the aggressive preset (DIV-93) Aug 27, 2026
@mahaloz
mahaloz merged commit 671cb79 into main Aug 27, 2026
9 checks passed
@mahaloz
mahaloz deleted the feat/armentrypreset branch August 27, 2026 20:13
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