Skip to content

Analysis-tier: ARM Thumb decode end-to-end (linked fixture) - #15

Merged
mahaloz merged 1 commit into
mainfrom
arm-thumb-decode-e2e
Jun 23, 2026
Merged

mahaloz merged 1 commit into
mainfrom
arm-thumb-decode-e2e

Conversation

@mahaloz

@mahaloz mahaloz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Increment 18 — ARM Thumb decode end-to-end (linked fixture)

The deferred Increment-8/17 end-to-end test: prove the analysis-tier arm_markers TMode paint + Thumb-FUNC re-home actually drive a correct Thumb decode through the full pipeline on a LINKED ARM executable (not the bare .o the unit test used).

Increments 8 and 17 proved the paint ($t/$a+STT_FUNC-LSB → TMode=1) and the re-home (even-address SymFact) only on arm_thumb_le32.o (ET_REL). The decode e2e was blocked because the build host had no ARM linker. The kuna-dev container now provides arm-linux-gnueabihf-gcc 11.4.0, so the e2e is no longer off-host.

BEFORE

  • Paint + re-home proven only on a bare .o UNIT test (arm_markers::tests). ObjectLoadImage reads only segments, so a bare ET_REL .o can't be loaded/decoded.
  • The full decode e2e (kuna decompile arm_thumb… <fn> producing valid Thumb-decoded C) was a documented off-host follow-up (no ARM linker in-env).

AFTER

A LINKED ARM Thumb fixture decompiles compute correctly in Thumb mode, end-to-end:

$ kuna decompile arm_thumb_linked_le32 compute
int4 compute(int4 a0)

{
  return a0 * 3 + 7;
}

$ kuna decompile arm_thumb_linked_le32 _start
void _start(void)

{
  compute(5);
  do {
  } while( true );
}

compute decodes to a0 * 3 + 7 (the lsls #1; add; adds #7 Thumb sequence) — an ARM-mode (A32) misdecode of the same byte stream would be garbage, so the arithmetic is the Thumb-mode proof. _start's bl to compute's even entry (0x100b8) resolves to the name compute — the Thumb-FUNC re-home payoff (without it the engine symbol table would only know compute at the odd 0x100b9, and the CALL would render sub_100b8).

What changed (purely additive, real-ELF path only)

  • New LINKED fixture arm_thumb_linked_le32 (1080 bytes, source vendored). ET_EXEC, one PT_LOAD R E segment at 0x10000 (so ObjectLoadImage loads it — the property the bare .o lacked). Built in-container:
    arm-linux-gnueabihf-gcc -mthumb -static -nostdlib -e _start arm_thumb_linked_le32.c -o arm_thumb_linked_le32 (arm-linux-gnueabihf-gcc 11.4.0). readelf -h: Type EXEC / Machine ARM; --syms: $t@0x100b8, compute FUNC@0x100b9 (LSB-set → even 0x100b8), _start FUNC@0x100d7 (→ even 0x100d6).
  • New console e2e kuna-console/tests/verify_arm_thumb_decode.rs (modeled on verify_w11_elf_plt_names.rs): bootstrap_from_elf → load function compute → decompile → print C, with the same specs-absent skip guard. Asserts the * 3 + 7 arithmetic (TMode paint) and that _start's call renders compute( not sub_100b8 (re-home).
  • Provenance line in tests/fixtures/README.md; docs/analysis-port-log.md Increment 18 + the arm-mips-markers work-list row updated.

No wiring fix was needed — the arm_markers pass + the commit seam (commit_analysis_output step 6, set_variable over the ContextDatabase before any decode) + the SLEIGH translator already decode Thumb correctly. The e2e ran a real decode (the ARM ARM8_le.sla is built; the skip guard was NOT hit).

Gates

  • make test → 675/675 PARITY OK
  • make test-stages → 158/158 PARITY OK
  • make rust-test → green, incl. verify_arm_thumb_decode::arm_thumb_compute_decodes_in_thumb_mode ... ok

The change is additive on the real-ELF path (a new fixture + a new console test; the arm_markers/commit code is unchanged), so the XML datatest oracle is structurally untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb

Increment 18: the deferred Increment-8/17 e2e — prove the analysis-tier
arm_markers TMode paint + Thumb-FUNC re-home drive a correct Thumb decode
through the full pipeline on a LINKED ARM executable (not the bare .o the
unit test used). The earlier off-host block (no ARM linker on the build
host) is lifted by the kuna-dev container's arm-linux-gnueabihf-gcc.

New LINKED fixture arm_thumb_linked_le32 (ET_EXEC, one PT_LOAD R E so
ObjectLoadImage loads it; compute = x*3+7 in Thumb). New console e2e
verify_arm_thumb_decode.rs (modeled on verify_w11_elf_plt_names): two
proofs in one drive —
  1. TMode paint: `load function compute` Thumb-decodes to `a0 * 3 + 7`
     (an ARM-mode misdecode of the same bytes is garbage).
  2. Thumb-FUNC re-home: `load function _start` renders the bl to
     compute's even entry as `compute(5)` (not an anonymous sub_<addr>).

No wiring fix was needed — the arm_markers pass + commit seam + SLEIGH
translator already decode Thumb correctly end-to-end; the test ran a real
decode (the ARM .sla is built, the skip guard was not hit). Purely
additive on the real-ELF path; the XML datatest oracle is untouched.

Gates: make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK;
make rust-test green (incl. verify_arm_thumb_decode).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
@mahaloz
mahaloz merged commit 929f2fb into main Jun 23, 2026
@mahaloz
mahaloz deleted the arm-thumb-decode-e2e branch July 29, 2026 08:01
mahaloz added a commit that referenced this pull request Sep 17, 2026
…read the live layout

Review round 2, engine half:

- No layout names a member glibc reserves for itself (`stat::__pad0`,
  `stat::__glibc_reserved`, `_IO_FILE::__pad5`, `_IO_FILE::_unused2`). Those
  offsets stay holes and print in the neutral offset form. Every truthful use of
  such a name is a whole-struct copy spilling padding; every use that carries
  meaning is a lie about an enclosing struct's real member -- diffutils `diff`
  emitted `v15[-1].__glibc_reserved[1]` for `cmp.file[N].desc`.
- `declared_libc_prototype` no longer hard-codes `Layout::Opaque`. It reads the
  layout off the program (`live_layout`): a held, field-filled aggregate is proof
  the load-time pass ran with `glibc` on an image the target gate accepted, which
  is the only evidence available to a `--define-function` directive that arrives
  after load and cannot re-run the gate.
- Stage test #15 restores the file-wide `field_0x` guard #6 used to carry, by
  pinning the count at the four occurrences pass 4 exists to show.
- Two unit tests: `no_layout_names_a_reserved_member`,
  `the_live_layout_is_read_off_the_program`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz added a commit that referenced this pull request Sep 17, 2026
mahaloz added a commit that referenced this pull request Sep 17, 2026
…read the live layout

Review round 2, engine half:

- No layout names a member glibc reserves for itself (`stat::__pad0`,
  `stat::__glibc_reserved`, `_IO_FILE::__pad5`, `_IO_FILE::_unused2`). Those
  offsets stay holes and print in the neutral offset form. Every truthful use of
  such a name is a whole-struct copy spilling padding; every use that carries
  meaning is a lie about an enclosing struct's real member -- diffutils `diff`
  emitted `v15[-1].__glibc_reserved[1]` for `cmp.file[N].desc`.
- `declared_libc_prototype` no longer hard-codes `Layout::Opaque`. It reads the
  layout off the program (`live_layout`): a held, field-filled aggregate is proof
  the load-time pass ran with `glibc` on an image the target gate accepted, which
  is the only evidence available to a `--define-function` directive that arrives
  after load and cannot re-run the gate.
- Stage test #15 restores the file-wide `field_0x` guard #6 used to carry, by
  pinning the count at the four occurrences pass 4 exists to show.
- Two unit tests: `no_layout_names_a_reserved_member`,
  `the_live_layout_is_read_off_the_program`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz added a commit that referenced this pull request Sep 29, 2026
…re a fold rewrites, and a carry

w_fold16/w_fold8/w_neg16/w_sub16/w_not16/w_xor16 compare a value computed
with + - ~ ^ against a constant a fold moves onto the stored value;
w_carry16 tests a carry. gcc -O0 fixture: main and the previous head DIFFER
(`hsink = a0 * 3; v1 = hsink == -1;`), this head AGREEs. Stage assertions
#15/#16: previous head 13/16, this head 16/16.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JiRmwW65ibgRi4sd1CkDiE
mahaloz added a commit that referenced this pull request Sep 29, 2026
/#16 (1502 -> 1504); footprint for readers a later rule makes sign-sensitive

The stages baseline gains only the two new globalvalue keys. Footprint: the
previous revision to this one changes 0 of 11,656 functions on 39 disjoint
binaries and no castbench file; main to this revision on the 12 added
binaries is 14 of 3,287, each classified, including the equivalent extra
store in scp O2 0xb730.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JiRmwW65ibgRi4sd1CkDiE
mahaloz added a commit that referenced this pull request Oct 1, 2026
…n earlier value

At -O0 a pointer stored to a global in both arms of a branch let
RulePushMulti replace the global's MULTIEQUAL with the frame variable's join,
so the load after `*pp = p` read the frame variable; RulePushMulti now leaves
a global's join whose input is a kept store. A load after a pointer store also
stays on the global when an earlier value of the global is read after the
store through a register; only a heritage gap still keeps upstream's handling.
The fixture gains g_old and g_branch; stage assertions #14 and #15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz added a commit that referenced this pull request Oct 1, 2026
…n earlier value

At -O0 a pointer stored to a global in both arms of a branch let
RulePushMulti replace the global's MULTIEQUAL with the frame variable's join,
so the load after `*pp = p` read the frame variable; RulePushMulti now leaves
a global's join whose input is a kept store. A load after a pointer store also
stays on the global when an earlier value of the global is read after the
store through a register; only a heritage gap still keeps upstream's handling.
The fixture gains g_old and g_branch; stage assertions #14 and #15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz added a commit that referenced this pull request Oct 1, 2026
…n earlier value

At -O0 a pointer stored to a global in both arms of a branch let
RulePushMulti replace the global's MULTIEQUAL with the frame variable's join,
so the load after `*pp = p` read the frame variable; RulePushMulti now leaves
a global's join whose input is a kept store. A load after a pointer store also
stays on the global when an earlier value of the global is read after the
store through a register; only a heritage gap still keeps upstream's handling.
The fixture gains g_old and g_branch; stage assertions #14 and #15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz added a commit that referenced this pull request Oct 2, 2026
…ugh its own variable (#798)

A pointer the binary stores to a global and keeps using from its register is printed as reads through the global, so the global's declared pointee type decides what is read.

```sh
cat > gptr.c <<'SRC'
#include <stdio.h>
char *gc;
__attribute__((noinline)) int p_int(int *p, int k) { int *q = p + k; gc = (char *)q; return q[1] + q[2]; }
int main(void) { int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; printf("%d\n", p_int(a, 2)); return 0; }
SRC
gcc -O2 -o gptr gptr.c && ./gptr        # 9
kuna decompile gptr p_int
```

```c
int p_int(int *a0,int a1)
{
  gc = &a0[a1];
  return gc[2] + gc[1];
}
```

Compiled with `char *gc` as declared, that body reads two bytes and returns 0. It now prints `a0 = &a0[a1]; gc = a0; return a0[2] + a0[1];`.

## Fix

- `Merge` no longer joins a global with a register value that is used as an address (a load or store address, or a `PTRADD`/`PTRSUB` base, directly or through the adds that offset it) in the optional `COPY` and adjacent merges (`p6_variables/kuna_pointeevalue.rs`). This holds whatever the global's type: kuna never prints the global's declaration, and the type it infers for it comes from these same uses.
- `RulePropagateCopy` keeps such a store's `COPY` out of the global's markers (`p3_dataflow/kuna_pointeestorekeep.rs`), so the forced merge at a call's `INDIRECT` or a join's `MULTIEQUAL` never takes the value.
- A load of the global the binary makes after a `STORE`, or after a call with no `INDIRECT` on the global, keeps reading the global, whether or not the load is used as an address: `gi = q; x = q[2]; *pp = p; return gi[1] + x;` prints `*a2 = a0; return v1 + gi[1];`. A register copy of such a load is not moved past a later store and prints as its own variable (`v2 = gi; *a3 = &a0[1]; return v1 + v2[1];`), and `RulePushMulti` no longer replaces a global's join of two such stores with the stored values' join, which at -O0 made the load read a frame variable.
- Not covered: a stored parameter, frame variable or constant, or a stored value never used as an address, keeps main's handling, where a load after a pointer store can still print the stored value (#792).

## Tests

- `tests/stages/kuna-globalpointee.xml`: 15 assertions over gcc -O2 and -O0 fixtures, all failing on main; #9 to #15 cover the loads after a pointer store.
- `kuna-cli/tests/global_pointee.rs`: the printed functions of gcc -O0, gcc -O2 and clang -O2 builds are compiled by gcc and clang at -O0 and -O2 with every global declared as in the source, and must print what the binary prints. The `g_` functions are called with the stored-through pointer aimed at the global itself. On main the gcc builds do not compile (`return gr[3] + *gr;`) and the clang build returns wrong values for `g_alias`, `g_reload`, `g_write`, `g_before`, `g_twice`, `g_old` and `g_branch`.
- Datatests 675/675 unchanged. Over 66 O0/O2/O2-noinline binaries (37,064 functions) 188 functions change and none gains or loses an error: values used as addresses keep their own variables, stores print where the binary makes them, and loads after a pointer store read the global (tar, rsyslogd `yylex`). Speed (decompile-all, interleaved, min of 11): diff -1.5%, grep -3.8%, tar -O2-noinline +0.3%, dash -O0 -2.4%; a synthetic 1,000-store function that reloads the global around pointer stores, +2.5%.

Fixes #767

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz added a commit that referenced this pull request Oct 7, 2026
… merge of the sorted hints

The slot-by-slot check only looked at hints starting exactly at each
slot, so a compiler-merged constant store (clang -O1 writes
`short a[6] = {1, 2, 3, 4, 5, x}`'s first four elements with one 8-byte
move) read as a broken chain: the mark on the last slot taken was
cleared and `on` printed `short v3[5]` plus a scalar where `off` prints
[6], with the loop index past the array.

extend_unbounded now only records each array it lengthens. Once
MapState::initialize has sorted the hints, restructure calls settle,
which runs the same merge steps (merge, the absorbing-base absorb,
attempt_join) over copies of the sorted hints with each array back at
its old high index, and clears COPY_CONSTANT on the last slot taken
only where that upstream merge ends the array at or before it.

Stage test #15 (clang -O1 short and char arrays with merged constant
stores) keeps the sixth element in every pass; baseline re-recorded
after the rebase onto af088aa (15 new keys, none missing); counts
moved to 270 settables, 94/108/68 tiers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39
mahaloz added a commit that referenced this pull request Oct 7, 2026
…t slots

The walk clause of the wide-array invariant demanded that every slot a
walk's guard keeps lie inside the array at the walk's base. That withdrew
the guard from functions whose layout it never changed (iproute2 ip -O2
print_linkinfo: two separate 16-byte buffers, as on main), decompiling
them twice: ip -O2 took 7% longer.

The final layout check now covers walks alone: the local at the lowest
base of an indexed access or walk must not be followed by guard-only
storage up to and including the start of the next local. That also
catches a guard-only slot the merge mapped to a register (a walk over
`struct {long a; int b; int c;} s[4]` left `long v4[3]` below an
`int v5; // edi | stack - 0x30`) and one past a gap (`unsigned int
v4[11]` two bytes below a guarded `short`). Stage assert #15 now also
covers those two walks (gcc -O2 wp, clang -O2 wq).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39
mahaloz added a commit that referenced this pull request Oct 7, 2026
…t slots

The walk clause of the wide-array invariant demanded that every slot a
walk's guard keeps lie inside the array at the walk's base. That withdrew
the guard from functions whose layout it never changed (iproute2 ip -O2
print_linkinfo: two separate 16-byte buffers, as on main), decompiling
them twice: ip -O2 took 7% longer.

The final layout check now covers walks alone: the local at the lowest
base of an indexed access or walk must not be followed by guard-only
storage up to and including the start of the next local. That also
catches a guard-only slot the merge mapped to a register (a walk over
`struct {long a; int b; int c;} s[4]` left `long v4[3]` below an
`int v5; // edi | stack - 0x30`) and one past a gap (`unsigned int
v4[11]` two bytes below a guarded `short`). Stage assert #15 now also
covers those two walks (gcc -O2 wp, clang -O2 wq).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39
mahaloz added a commit that referenced this pull request Oct 7, 2026
…t slots

The walk clause of the wide-array invariant demanded that every slot a
walk's guard keeps lie inside the array at the walk's base. That withdrew
the guard from functions whose layout it never changed (iproute2 ip -O2
print_linkinfo: two separate 16-byte buffers, as on main), decompiling
them twice: ip -O2 took 7% longer.

The final layout check now covers walks alone: the local at the lowest
base of an indexed access or walk must not be followed by guard-only
storage up to and including the start of the next local. That also
catches a guard-only slot the merge mapped to a register (a walk over
`struct {long a; int b; int c;} s[4]` left `long v4[3]` below an
`int v5; // edi | stack - 0x30`) and one past a gap (`unsigned int
v4[11]` two bytes below a guarded `short`). Stage assert #15 now also
covers those two walks (gcc -O2 wp, clang -O2 wq).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39
mahaloz added a commit that referenced this pull request Oct 15, 2026
Resolve the option-count conflicts against main's multiregargs and
libcnames: 307 settables, tiers (111, 117, 79), catalog JSON rows 306,
kuna-catalog #15 at 313, corpus file count 549. Re-record
docs/baseline-stages.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RVkhSR3PZKoRmKDbGHjfqH
mahaloz added a commit to thotypous/kuna that referenced this pull request Oct 15, 2026
Re-derives every count with indirectargs on top of multiregargs (Noelo-Lab#1070)
and rettriangle (Noelo-Lab#1109): settables 308, tiers (112,117,79), catalog JSON
records 307, live-field options 139, kuna-catalog.xml Noelo-Lab#15 308 rows (314
matches), corpus files 550; phase_catalog.json recaptured, docs/options.md
regenerated and docs/baseline-stages.json re-recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RVkhSR3PZKoRmKDbGHjfqH
mahaloz added a commit that referenced this pull request Oct 19, 2026
Permit the count-bearing KUNA-CATALOG #15 stage key to change only when
both trees agree on source and captured catalog counts, the exact XML
bounds and pattern, and the same six valid individual catalog queries.
Keep all unrelated removals, duplicate entries, stale footers, and
upstream baseline changes rejected.

Add temporary-history tests for the valid rename and malformed evidence,
and document the derived exception. The four required checks, tooling,
lint, catalog validation, and merge checks pass.
mahaloz added a commit that referenced this pull request Oct 19, 2026
…1206)

Permit the count-bearing KUNA-CATALOG #15 stage key to change only when
both trees agree on source and captured catalog counts, the exact XML
bounds and pattern, and the same six valid individual catalog queries.
Keep all unrelated removals, duplicate entries, stale footers, and
upstream baseline changes rejected.

Add temporary-history tests for the valid rename and malformed evidence,
and document the derived exception. The four required checks, tooling,
lint, catalog validation, and merge checks pass.
mahaloz added a commit that referenced this pull request Oct 25, 2026
…ang override, Swift detection (#1265)

The language a binary was compiled from was detected seven times per run and
reached the engine as two bools. It is now one fact: detection runs behind
effective_compiler()/effective_compiler_bytes(), which honour the new
`sourcelang` option (auto|c|rust|go|swift, default auto) carried into `load
file` as KUNA_SOURCELANG (the rexthunk loadtime pattern), and the engine
records it as Architecture::source_lang_detected (a SourceLang, replacing
source_is_rust/source_is_go) with `option sourcelang` layering a per-run
force on top. rustabi/reloadarg read the one fact; the output-language auto
policy consults a forced option in the parent process before the subprocess
env exists.

Swift joins Compiler: swift5 metadata sections under any format's spelling
(__swift5_*/swift5_*/.sw5*), Swift-mangled symbols ($s/$S/_T0 held to the
scheme's next token), or the Swift runtime import set. Nothing gates on it
yet - a Swift binary's pass set is pinned byte-identical to a clang one -
the verdict exists so the fact is right and the multilang packs
(docs/multilang.md, added here) have a plane to gate on.

Speed: decompile-all on /bin/tar (522 KB, reliable), interleaved min-of-5:
auto 40.13 s vs forced 40.05 s (-0.2%, noise). The default path's only new
work is one env read per former detection site.

Gates: make test PARITY OK (675/675), make test-stages PARITY OK (baseline
re-record: the kuna-catalog #15 row-count assertion renamed 328->329),
make rust-test green (the darwin/arm64 go cross-build test needs go>=1.22;
host go 1.18 fails it on a hello-world with no kuna involved), make
check-spec OK, make test-cli 306/306, make lint clean, kuna catalog --check OK.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WoTv7T2Ep5hmbZcyYSMk1g
mahaloz added a commit that referenced this pull request Oct 25, 2026
…fault auto) (#1266)

Every non-leaf Go function opens with a guard: compare SP against the
goroutine's stackguard, on failure call runtime.morestack(_noctxt) and loop
back to the function entry. The back-edge makes the entry a loop head, so
every live argument register reaches an entry phi and the body renders
wrapped in a while(true) with a morestack call in its latch.

The matcher is the first shared entry-guard-loop shape in infra/idiom.rs
(docs/multilang.md W2): the cold arm's one predecessor and one successor are
the same CBRANCH-terminated guard block, which sits directly on the inserted
empty entry block; only inside that shape is the callee name consulted
(runtime.morestack and its _noctxt/c/.abi0 spellings - pclntab names, so a
stripped binary folds too). The edit is remove_branch on the guard's cold
edge plus the unreachable sweep, pre-SSA (the cleanupcode window), so the
entry phi never forms. auto (default) acts only when the sourcelang fact is
Go; always drops the language test for no-signal corpora; off keeps the
guard for auditing.

Measured on a stripped go1.22 build (1,543 fns): 623 of 1,144 guard-carrying
functions fold and whole-binary decompile-all runs 3.8% faster (17.73 s ->
17.06 s min-of-3). The 521 misses share one cause - the grow arm physically
follows a runtime.panic* helper the vendored Go no-return list predates
(panicshift, panicunsafestringlen, ...), so a bogus fallthrough edge breaks
the tight cycle; that is a no-return coverage gap (filed in docs/multilang.md,
Go pack), not a matcher defect, and the matcher deliberately stays tight.
On non-Go binaries the gate short-circuits: two interleaved min-of-5 runs on
/bin/tar disagreed in sign (+2.3%/-4.3%), so the cost is below the
measurement floor.

Gates: make test PARITY OK, make test-stages PARITY OK (baseline re-record:
4 new GOMORESTACK keys, catalog #7 gained gomorestack in its exact
structure-recovery list, #15 count 330), make rust-test green (one
documented env-race flake, idle-green), check-spec OK, test-cli 306/306,
lint clean, catalog --check OK. End-to-end: verify_go_morestack builds a
real stripped Go binary and proves the detection-driven auto path.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WoTv7T2Ep5hmbZcyYSMk1g
mahaloz added a commit that referenced this pull request Oct 25, 2026
…)/330, corpus 586, catalog #15 331/337, w8 295, merged-tree artifact regen, stages baseline re-record

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WoTv7T2Ep5hmbZcyYSMk1g
mahaloz added a commit that referenced this pull request Oct 25, 2026
…/331, catalog #15 332/338, merged-tree artifact regen, stages baseline re-record. Combined effect on the go1.22 witness: morestack-carrying functions 1,144 -> 66 (94% fold, was 521 with gomorestack alone)

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WoTv7T2Ep5hmbZcyYSMk1g
mahaloz added a commit that referenced this pull request Oct 25, 2026
…28,85)/332, corpus 587, catalog #15 333/339, merged-tree artifact regen, stages baseline re-record

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WoTv7T2Ep5hmbZcyYSMk1g
mahaloz added a commit that referenced this pull request Oct 25, 2026
mahaloz added a commit to alvistar/kuna that referenced this pull request Nov 7, 2026
Counters re-derived again for f6101c6 (deadcascade): 382 settables,
tiers 131/155/96, 381 catalog JSON rows, KUNA-CATALOG Noelo-Lab#15 at 382 rows
(388 "option" matches), a corpus of 705 files, and
docs/baseline-stages.json re-recorded (3877 passing keys).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKS1xSN6UHyTiGivmGe
mahaloz added a commit to alvistar/kuna that referenced this pull request Nov 7, 2026
Counters re-derived for the merged tree (a8b747e): 380 settables
(main's 379 plus armderef), tiers 131/154/95, 181 live values, 379
catalog JSON rows, KUNA-CATALOG Noelo-Lab#15 at 380 rows (386 "option"
matches), a corpus of 703 files (main's 702 plus the stage file), and
docs/baseline-stages.json re-recorded on the merged build (3869 passing
keys: main's plus the four ARMDEREF assertions). The catalog_bytecompat
and kuna-catalog counts merged without a conflict at main's 379, one
short, because both sides had moved them from 378 to 379.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKS1xSN6UHyTiGivmGe
mahaloz added a commit to alvistar/kuna that referenced this pull request Nov 7, 2026
Counters re-derived again for f6101c6 (deadcascade): 381 settables,
tiers 131/155/95, 380 catalog JSON rows, KUNA-CATALOG Noelo-Lab#15 at 381 rows
(387 "option" matches), a corpus of 704 files, and
docs/baseline-stages.json re-recorded (3873 passing keys). The settable,
JSON-row, catalog_bytecompat, KUNA-CATALOG Noelo-Lab#15, corpus and stage-baseline
counts all merged without a conflict at main's values, one short,
because both sides had moved them by one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKS1xSN6UHyTiGivmGe
mahaloz added a commit to phix33/kuna that referenced this pull request Nov 7, 2026
Takes Noelo-Lab#1498's merge with main; Noelo-Lab#1423 conflicts resolved as in the review trial merge (Octeon selector before the generic MIPS selector, scan_mips_markers' second argument, kuna_mipsabi readers kept from both). Counters re-derived: 382 settables, (134,154,94) tiers, 183 live, KUNA-CATALOG Noelo-Lab#15 382/388, corpus 705; stages baseline re-recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKS1xSN6UHyTiGivmGe
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 9, 2026
…rn-address test

ptrauthtrap (default on, now on every AArch64 path) cut the CBRANCH edge into
a brk #0xc470..0xc473 block whenever the guard was the x30 bit test, without
asking which arm the trap sat on or where x30 came from:

- Polarity: `tbz x16, Noelo-Lab#62, trap` (trap when bits 62 and 61 agree, i.e. on
  every authentic return address) lost its trap, so a function that always
  crashes printed as its never-taken arm (`secret(); return 7;`). The
  condition's polarity is now followed through the INT_EQUAL/NOTEQUAL/
  BOOL_NEGATE chain and the CBRANCH's boolean flip, and only the arm taken
  when the bits disagree is cut.
- Provenance: "unwritten in the block" let a `mov x30, x1` (or arithmetic)
  one block earlier through, and any LOAD counted as the frame reload, so
  `ldr x30, [x0]` passed too. x30 must now be unwritten anywhere in the
  function, or reloaded by a LOAD whose address is sp or x29 plus constants.

The real shapes (ldp x29,x30 post-index or offset, ldr x30 [sp],Noelo-Lab#16,
ldur x30 [x29,#8], mov sp,x29 epilogue, tbz and tbnz forms, leaf with x30
untouched) are still cut; all 52 AArch64 repo samples decompile byte-
identically to the previous head. Tests: tests/stages/kuna-ptrauthtrap.xml
#14 (inverted polarity), Noelo-Lab#15 (forgery in an earlier block), Noelo-Lab#16 (non-frame
load); all three fail on the previous head. Stages baseline: the 3 new keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKS1xSN6UHyTiGivmGe
mahaloz added a commit to thotypous/kuna that referenced this pull request Nov 13, 2026
Settables 211 -> 212 (cvftrace); KUNA-CATALOG Noelo-Lab#15 217 -> 218 by hand;
docs/options.md regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit to borancar/kuna that referenced this pull request Nov 13, 2026
Settables 212 -> 213 (calleereginputs), tiers 43/117/53; KUNA-CATALOG Noelo-Lab#15
218 -> 219 by hand; stage corpus count 746 -> 747; docs/options.md regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit to borancar/kuna that referenced this pull request Nov 16, 2026
… by-value block

The calleeargs window is what the callee's returns pop or what the caller
removes after the call. For a __cdecl callee that is the caller's cleanup,
or an `add esp` releasing the caller's own locals before its epilogue, and
stating it as the call's pop moved every stack slot after the call: the
caller lost a parameter or read one in place of a local. It also let a
bottom-of-frame local, or a block built for a later call (`f(g(0), t)`
copies t, then calls g), expand into the next call's arguments.

Flow now records what the callee's reached returns pop (`ret 0x20`) on the
call spec, and repframecopy relies on that alone. byvalreuse_pe_i386 gains
cleanup, local and nested; REPFRAMECOPY Noelo-Lab#15-Noelo-Lab#17 fail without this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 19, 2026
Both sides added one option, so the settable, catalog-record and
KUNA-CATALOG Noelo-Lab#15 counts each move by two from the merge base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 19, 2026
…nts at

A fill or copy whose destination or source is a global printed the raw
address, builtin_memset((void *)0x4ae1a0,0,0x100), where the loop it
replaces printed &dat_4ae1a0 or the symbol: the constant now feeds the
CALLOTHER instead of the COPY into EDI that ActionConstantPtr and
globalref recognise. Both now treat a repstring builtin's pointer operand
as a pointer reader (gated on the option): ActionConstantPtr binds an
exact symbol hit, globalref names an unnamed global &dat_<addr>.
Pinned by repstring #14/Noelo-Lab#15 (a gcc 15 -O2 fill of a mapped global) and
REPFRAMECOPY #8b (now &dat_402000).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit to thotypous/kuna that referenced this pull request Nov 19, 2026
Settable, tier, bytecompat, catalog-record, live-field and KUNA-CATALOG Noelo-Lab#15
counts are main's plus one for stackalloc; recapture phase_catalog.json and
regenerate docs/options.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
typevote (main) and gotonext (this branch) each add one option: 224
settables, tiers 46/122/56, 79 live fields, 223 catalog records,
KUNA-CATALOG Noelo-Lab#15 232; phase_catalog.json recaptured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
postinc joins typevote and gotonext from main: 225 settables, tiers
46/123/56, 80 live fields, 224 catalog records, KUNA-CATALOG Noelo-Lab#15 233,
308 schedule registrations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
panicloc joins postinc, typevote and gotonext from main: 226 settables,
tiers 46/123/57, 81 live fields, 225 catalog records, KUNA-CATALOG Noelo-Lab#15
234; phase_catalog.json recaptured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
opaquepredicate joins postinc, panicloc, typevote and gotonext from main:
227 settables, tiers 46/124/57, 82 live fields, 226 catalog records,
KUNA-CATALOG Noelo-Lab#15 235, 310 schedule registrations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
calltable joins opaquepredicate, postinc, panicloc, typevote and gotonext
from main: 228 settables, tiers 46/124/58, 227 catalog records,
KUNA-CATALOG Noelo-Lab#15 236 (calltable has no live field: 82 unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
mahaloz added a commit that referenced this pull request Nov 21, 2026
[AUTOMATED] Counts: 229 settables (46 core / 125 transform / 58 analysis), 849 stage files,
catalog #7 39 / #15 237; options.md, phase_catalog.json and the stage baseline (4944) regenerated.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQdVZFuvdNY1SVmGFY
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
cstringconst joins calleefilledarg from main: 231 settables, tiers
48/124/59, 84 live fields, 230 catalog records, KUNA-CATALOG Noelo-Lab#15 239.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 21, 2026
switchextent joins calleefilledarg and cstringconst from main: 232
settables, tiers 48/125/59, 85 live fields, 231 catalog records,
KUNA-CATALOG Noelo-Lab#15 240.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
coleleavitt added a commit to coleleavitt/kuna that referenced this pull request Nov 22, 2026
…e-structure (Noelo-Lab#1757) into gap/relswitch

Conflicts and their resolution:
- kuna-base xml.rs corpus count: union of the stage lists, 865 files.
- kuna_phases tests / catalog_bytecompat: 240 settables (each side had
  236 with different additions); tier and with_live counts from the
  union; catalog-json record count 239.
- tests/stages/kuna-catalog.xml Noelo-Lab#15: 248 option rows (240 + 8 queries).
- architecture.rs reset defaults: both sides' lines kept.
- list_action_decompile_snapshot.txt / verify_w8 count: three-way merge
  of the action lists (314 lines).
- kuna_aifdataveto.rs: relswitch's register-carry scan plus Noelo-Lab#1763's skip
  of ARM PC-relative literal loads (which also clears the carried bases).
- docs/spec 01 and 02: both paragraphs kept.
- phase_catalog.json recaptured; docs/baseline-stages.json re-recorded
  (4990/4990, no assertion removed: the union's newly passing tests).
coleleavitt added a commit to coleleavitt/kuna that referenced this pull request Nov 22, 2026
…e-structure (Noelo-Lab#1757) into gap/relswitch

Conflicts and their resolution:
- kuna-base xml.rs corpus count: union of the stage lists, 865 files.
- kuna_phases tests / catalog_bytecompat: 240 settables (each side had
  236 with different additions); tier and with_live counts from the
  union; catalog-json record count 239.
- tests/stages/kuna-catalog.xml Noelo-Lab#15: 248 option rows (240 + 8 queries).
- architecture.rs reset defaults: both sides' lines kept.
- list_action_decompile_snapshot.txt / verify_w8 count: three-way merge
  of the action lists (314 lines).
- kuna_aifdataveto.rs: relswitch's register-carry scan plus Noelo-Lab#1763's skip
  of ARM PC-relative literal loads (which also clears the carried bases).
- docs/spec 01 and 02: both paragraphs kept.
- phase_catalog.json recaptured; docs/baseline-stages.json re-recorded
  (4990/4990, no assertion removed: the union's newly passing tests).
coleleavitt added a commit to coleleavitt/kuna that referenced this pull request Nov 22, 2026
Re-derive the corpus count (867), settable count (234), tier counts
(49/125/60), catalog JSON row count and KUNA-CATALOG Noelo-Lab#15 (242) at the
merged tip. kuna-elfgot-noreturn #5 now expects die("big"): upstream
resolves the AArch64 adrp/add string argument, and the no-return mark
the test checks is unchanged.

docs/baseline-stages.json re-recorded at the merged tip (sanctioned
upstream-merge re-record): 5016/5016 assertions pass; the two keys that
left the baseline were renamed upstream (GOTTAILCALL #4 by Noelo-Lab#1733,
KUNA-CATALOG #7's option list).
mahaloz added a commit to coleleavitt/kuna that referenced this pull request Nov 22, 2026
cachereturn joins switchmerge from main: 234 settables, tiers 50/125/59,
87 live fields, 233 catalog records, KUNA-CATALOG Noelo-Lab#15 242.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
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