Repository navigation
[AUTOMATED] feat(p1): cortexmvectors - widen the ARM Cortex-M vector-table signature - #248
Merged
Merged
Conversation
…table signature Step 1 of the approved ARM entry-recall sequence ([PROPOSAL] #239), which measured 2,026 of 2,061 live recall misses (98.3%) as function-entry granularity on embedded ARM Cortex-M and called this step SMALL and independent. Entry-discovery oracle 6 confirms a hardware vector table only when it starts a section the loader maps executable, word[0] is in 0x20000000-0x3FFFFFFF, and word[1] == e_entry. All three over-constrain real firmware, and between them they silently no-op the four biggest contributors: cleanflight and betaflight link .isr_vector as an A-only section inside a read-only PT_LOAD with a 0x1000fff0 CCM stack word; crazyflie and nuttx point e_entry somewhere other than the reset vector. A fourth defect surfaced while measuring: betaflight's table is linked into RAM ABOVE the flash it points at, so the harvest's "stop at the start of code" rule fires on the second slot and the table looks one word long. With --option cortexmvectors on, a candidate is any allocated section whose word[0] lands in 0x10000000-0x3FFFFFFF and whose slots from word[1] yield at least three Thumb handler pointers. The run of handlers replaces the e_entry equality; it is counted by the same harvest loop the oracle then seeds from, over accepted SLOTS not distinct addresses (a bare-metal table aims most vectors at one shared Default_Handler). The start-of-code stop is additionally conditioned on the lowest handler lying at or above the table base. The widened scan runs only where the shipped signature found nothing, so it can add entries but never remove one. Measured on the stripped decbench ARM corpus (16 binaries x 3 opt levels, 41,378 DWARF entries) against the compiled/ binaries' DWARF: kuna functions (Listing on): recall 38,238 -> 38,334 (+96); 118 new entries, 96 ground truth (81.4%), 0 splitting a real body, 22 outside any body, ZERO entries lost anywhere. --option listing off: recall 8,885 -> 9,278 (+393); 415 new entries, 393 ground truth (94.7%), 0 splits, 0 lost. betaflight goes from ONE recovered function to 57. Byte-identical decompile-all output off vs on for x86-64 (gzip), ARM Linux (u-boot), and the four Cortex-M images the shipped signature already detects. Wiring: a standalone CortexMVectorsPass stashed at load and gated at commit, the eh_frame_full/funcstart_patterns shape (reading the flag inside EntryDiscoveryPass silently did nothing - load-time passes run before --option is applied). The pass emits entry facts and context paints ONLY; feeding the widened handlers to the Listing walk was measured and rejected (+44 recall with 54 ground-truth entries lost, because the walk absorbs the shared handler an ISR stub tail-calls). That is proposal step 3's tail-call split. Default-OFF, no DIV row: default output is byte-identical. Two-pass gate is a Rust cross-crate test (verify_cortexmvectors.rs) over a new 357-byte hand-assembled fixture, not a stages XML - the oracle keys on ELF structure the datatest harness does not construct, the same reason every sibling analysis-tier discovery flag is gated that way. Gates: make test 675/675 PARITY OK; make test-stages 356/356 PARITY OK; make rust-test green; make check-spec OK (lenient + strict); catalog OK. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
This was referenced Aug 3, 2026
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]>
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of the approved ARM entry-recall sequence ([PROPOSAL] #239), which measured
2,026 of 2,061 live recall misses (98.3%) as function-entry granularity on embedded ARM
Cortex-M and called this step SMALL and independent.
Full write-up:
docs/features/cortexmvectors/analysis.md.The bug
entry/mod.rs::cortexm_vector_table(entry-discovery oracle 6) confirms a Cortex-M hardwarevector table only when it starts a section the loader maps executable,
word[0]is in0x2000_0000..=0x3FFF_FFFF, andword[1] == e_entry. All three over-constrain realfirmware, and between them they silently no-op the four biggest contributors to the gap:
word[0]word[1]vse_entryAX, orWAin anRWEload (PR #224).isr_vectorA-only in a read-onlyPT_LOAD0x1000fff0(CCM RAM)0x200000000x1000fff0.isr_vector@0x080040000x2001ffff0x0801a811vs0x080041c0.text@0x080000000x200019080x08000a95vs0x08000189The table is data the CPU reads — what must be executable is what its slots point at,
which the harvest already checks. STM32F4/
-M7parts put the initial stack in CCM/TCM at0x1000_0000. Ande_entryis the ELF's start symbol, which a bare-metal link script isfree to point somewhere other than the reset vector. PR #224 made the first argument and
stopped one step short.
A fourth defect surfaced while measuring: betaflight's table is linked above the flash it
points at, so the harvest's "stop once the scan reaches the start of code" rule fires on the
second slot and the table looks one word long.
The fix —
--option cortexmvectors on|off(default-OFF)A candidate is confirmed when it starts any allocated section,
word[0]lies anywhere in0x1000_0000..=0x3FFF_FFFF, and its slots fromword[1]yield at least three Thumb handlerpointers (odd, in an executable section). The run of handlers replaces the
e_entryequality; it is counted by the same harvest loop the oracle then seeds from, over accepted
slots rather than distinct addresses (a bare-metal table aims most vectors at one shared
Default_Handler). The start-of-code stop is additionally conditioned on the lowest handlerlying at or above the table base.
Monotonic by construction: the widened scan runs only where the shipped signature found
nothing, so an image that already resolved a table resolves the same section with the same
harvest. The option can add entries; it cannot remove one.
New module
decompiler/crates/kuna-analysis/src/analyzers/entry/kuna_cortexmvectors.rs,carrying a standalone
CortexMVectorsPass(id() == "cortexmvectors") stashed at load andgated at commit by
engine.rs::analysis_pass_enabled— theeh_frame_full/funcstart_patternsshape.Acceptance measurement
Re-measured on this branch against the stripped binaries decbench feeds, with ground
truth from the matching
compiled/binary's DWARF. 16 binaries x 3 optimisation levels,41,378 ground-truth function addresses. Per-binary tables:
analysis.mdsection 5, raw diff inmeasurements.txt.Default decbench surface (
kuna functions, Listing on)Totals: recall 38,238 -> 38,334 (+96). 118 new entries, 96 (81.4%) ground-truth DWARF
function addresses, 0 splitting a real body, 22 outside any DWARF body. Zero entries lost,
on any binary, at any optimisation level.
The 22 "outside any DWARF body" are vector slots pointing at debug-info-free
compiler-runtime/startup code (crazyflie's shared
Default_Handlerat0x801a890) — realcode the hardware enters, not error.
Without the Listing tier (
--option listing off:--mode fast, the WASM and Ghidra front-ends, single-functionkuna decompile)Totals: recall 8,885 -> 9,278 (+393). 415 new entries, 393 (94.7%) ground truth, 0 splits,
0 lost. betaflight goes from one recovered function to 57: this is the surface where
the whole-image Thumb region paint, which only a confirmed table unlocks, is load-bearing.
Strict no-op elsewhere
Whole-binary
kuna decompile-all --jsonis byte-identical (sha256) off vs on for x86-64(
gzip), ARM Linux (u-boot), and the four Cortex-M images the shipped signature alreadydetects (libopencm3
msc.elf, chibiosch.elf, freertosRTOSDemo.out, riot-oshello-world.elf).A measured design decision worth reading
The widened table's facts can reach three consumers. All three were built and measured:
ContextPainterHanding the walk more seeds costs recall. Traced on crazyflie: the vector points at
0x8010bd4, an ISR stubldr r0,=i2c1Dev ; b i2cdrvDmaIsrHandler.listing/walk.rstreatsan unconditional
Bas same-function flow, so the walk absorbsi2cdrvDmaIsrHandler(
0x8010458); that address is then no longeris_undefined, socode_pointer_table_seedsrejects the code pointer to it and the AIF gap scan no longer seesa gap. Fourteen ground-truth ISR handlers disappear that way on one binary. That is exactly
the tail-call split proposal step 3 owns — so this PR keeps the pass purely additive, which
also makes "never removes an entry" a property of the wiring rather than of a heuristic.
Tests — a Rust two-pass gate, not a
tests/stages/*.xmlThe oracle keys entirely on ELF structure:
sh_flags,PT_LOADflags,e_entry, andthe bytes at a section's base. The datatest/stages harness embeds raw
<bytechunk>s withexplicit
<symbol>definitions and never constructs anObjectLoadImage, so none of thosefacts exist on that path and the option is unobservable there. Every sibling analysis-tier
discovery flag (
funcstart_patterns,aif,eh_frame_full,i386_pie_plt) is gated thesame way. The two-pass case is therefore
decompiler/crates/kuna-console/tests/verify_cortexmvectors.rs, over a new 357-bytehand-assembled fixture (
cortexm_ccm_vectors_le32, with its committed generator and afixtures-README row) that fails all three shipped predicates at once:
the one function
e_entryfinds produces no C at all (nothing paintsTMode=1, so itsThumb halfwords are decoded as A32);
(
sub_8008004->return 7;). An A32 read of those bytes does not produce that, so thearithmetic is the Thumb-paint proof.
Consequently
kuna-base/src/xml.rs' corpus file count anddocs/baseline-stages.jsonareuntouched. Seven unit tests in the new module cover each real-world shape, the
.datafalse-positive floor, the two-vs-three-handler threshold, the non-ARM no-op, and
shipped-match monotonicity.
Speed
Median of 3 whole-binary runs, off vs on:
kuna functionscleanflight −3.33%, nuttx +2.88%,msc.elf −1.81%;
kuna decompile-allcleanflight −6.91%, nuttx +0.79%, msc.elf +8.87%. Thescan is O(sections x <=1024 slots) and unmeasurable; the deltas are the extra decompile work
for the extra functions against run-to-run noise — msc.elf is the byte-identical no-op case,
so its +8.87% on a 0.7-second run bounds the measurement error.
scripts.pipeline.timeiton the fixture: off 92.41 ms, on 85.13 ms, −7.88%, within the 5%budget.
Default decision
Default-OFF, no DIV row. The option discovers more functions, so it changes emitted C by
construction; default output is byte-identical. The
docs/baseline.jsonablation isstructurally clean (the XML datatest path never builds an
ObjectLoadImage, so oracle 6cannot fire there) but that is evidence of non-interference, not of quality. A default flip
belongs with a corpus sweep across more ARM firmware than decbench carries — the same
decision proposal step 2 defers.
Gates
🤖 Generated with Claude Code