Skip to content

Analysis-tier: cross-arch _start→main idiom (AArch64/ARM/RISC-V) - #19

Merged
mahaloz merged 2 commits into
mainfrom
crossarch-entry-main
Jun 23, 2026
Merged

mahaloz merged 2 commits into
mainfrom
crossarch-entry-main

Conversation

@mahaloz

@mahaloz mahaloz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Cross-arch _start→main idiom (oracle 4) — AArch64 / ARM / RISC-V

Extends the s1_entry oracle-4 _start→main libc-start idiom (Increment 23) beyond x86-64.

BEFORE

Oracle 4 was x86-64-only (a documented LOSS: "oracles 4–5 are x86-64-only in v1; other arches no-op"). For a STRIPPED non-x86 PIE where .eh_frame is absent or does not cover main (e.g. built -fno-*-unwind-tables), main is recoverable from no oracle — it has no symbol, no FDE, and the x86-64 lea rdi byte-pattern never matches. main is lost.

AFTER

Each of AArch64, ARM/Thumb, RISC-V byte-decodes the arg0-setup in _start to a GOT-slot VMA, then resolves that slot through the dynamic R_*_RELATIVE relocation map (RELA addend, or the in-place GOT word for ARM REL) → main's VMA. Same disassembly-free, targeted-decode style; gated per arch on file.architecture(); the resolved VMA is validated inside an executable section before emitting; additive to AnalysisOutput.entries (real-ELF path only — rides the always-on entry_disc pass, no new flag).

Each fixture is a tiny int main(int c,char**v){return c;} built DYNAMIC (real crt1 _start → __libc_start_main(main,…)), unwind tables dropped, -fvisibility=hidden (so main is in no symbol table), then stripped — so main is discoverable only via the idiom. e2e bootstraps the stripped fixture, then load function sub_<main> → decompile → print C with NO --addr:

AArch64 (entrymain_aarch64, _start@0x600 → main@0x714 via adrp x0;ldr x0,[x0,#4080] → GOT slot 0x10ff0):

unsigned int sub_714(unsigned int a0)

{
  return a0;
}

ARM/Thumb (entrymain_arm, _start@0x3dd → main@0x4d8 GOT-relatively, slot 0x10ff8 → 0x4d9 = main|Thumb-LSB; discovery-derived TMode=1 Thumb paint):

unsigned int sub_4d8(unsigned int a0)

{
  return a0;
}

RISC-V (entrymain_riscv64, _start@0x550 → main@0x608 via auipc a0;ld a0,-1318(a0) → GOT slot 0x2030):

int8 sub_608(int4 a0)

{
  return (int8)a0;
}

Arches succeeded

All three (AArch64, ARM/Thumb, RISC-V) recover and decompile main end-to-end. No gaps. MIPS/PPC _start idioms are a documented follow-up (those arches no-op). Oracle 5 (prologue patterns) stays x86-64-only.

The ARM case additionally exercises a TMode=1 ContextPaint derived from the GOT pointer's Thumb LSB — the analog of arm_markers' STT_FUNC-LSB → TMode=1, since a stripped binary has no $t mapping symbol. Without it the Thumb body misdecodes as A32 (a void {return;} stub). This also closes the previously-documented "ARM decode e2e blocked off-host" gap — the kuna-dev container has the ARM toolchain, so a LINKED ARM/Thumb PIE is now built + decoded in-env.

Tests (actually run, not skipped)

  • kuna-analysis +4 units: libc_start_main_idiom_{aarch64,arm,riscv} (pin GOT slot + RELATIVE target + recovered main); collect_entries_crossarch_includes_main (proves oracle 4 specifically contributes main — non-funcsym, in an exec section).
  • kuna-console +3 e2e (verify_crossarch_entry_main.rs): the discovered, never-symboled main decompiles by sub_<addr> with no --addr to a real return a0 body.
  • The x86-64 oracle-4 path (libc_start_main_idiom_stripped, verify_s1_entry) is unchanged (now dispatched through the per-arch libc_start_main_target).

Gate results

  • make test → 675/675 PARITY OK
  • make test-stages → 158/158 PARITY OK
  • make rust-test → green (exit 0)

🤖 Generated with Claude Code

https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb

mahaloz and others added 2 commits June 23, 2026 16:45
Extend the s1_entry oracle-4 _start→main libc-start idiom (previously
x86-64-only, a documented LOSS) to AArch64, ARM/Thumb, and RISC-V, so a
STRIPPED non-x86 PIE — where .eh_frame may be absent or not cover main —
still recovers main without a symbol. Same disassembly-free, targeted
byte-decode style; gated per arch on file.architecture(); the resolved VMA
is validated inside an executable section before emitting; additive to
AnalysisOutput.entries (real-ELF path only, rides the always-on entry_disc
pass — no new flag).

Unlike x86-64 (main as a PC-relative immediate in `lea rdi,[rip+disp]`),
the PIE crt1 of all three loads main *indirectly* from a GOT slot bearing an
R_*_RELATIVE relocation whose target is main's VMA. So the decode is two
steps: byte-decode the arg0-setup in _start to the GOT-slot VMA, then resolve
it through a got_slot→relative_target map (relative_targets): the RELA addend
(AArch64/RISC-V) or the in-place GOT word for ARM REL (has_implicit_addend).

- AArch64 (x0): adrp x0,page; ldr x0,[x0,#lo12] → slot → RELATIVE → main.
- RISC-V  (a0): auipc a0,hi20; ld a0,lo12(a0) → slot → RELATIVE → main
  (scanned at 2-byte steps for the RVC mix).
- ARM/Thumb (r0): GOT-relative ldr r0,[GOT_base,r0]; using the invariant that
  the GOT base is the .got section address, candidate slot = .got+off for each
  small literal-pool word, cross-checked against the RELATIVE map + exec
  section (unique winner). The ARM main pointer carries the Thumb mode bit in
  bit 0 — masked for the entry, AND the discovery pass emits a TMode=1
  ContextPaint at main (the analog of arm_markers' STT_FUNC-LSB → TMode=1,
  derived from the GOT pointer LSB since a stripped binary has no $t symbol),
  without which the Thumb body misdecodes as A32.

All three target arches succeed end-to-end (stripped main recovered AND
decompiled to `return a0`). MIPS/PPC _start idioms remain a follow-up.
Oracle 5 (prologue patterns) stays x86-64-only. The x86-64 oracle-4 path is
unchanged (now dispatched through the per-arch libc_start_main_target).

Fixtures: entrymain_{aarch64,arm,riscv64} (vendored, <7 KB, shared source
entrymain.c), built in kuna-dev with -fno-*-unwind-tables (isolate the FDE
oracle) + -fvisibility=hidden (keep main out of .dynsym — required on RISC-V
where .dynsym survives strip) + strip. RISC-V needs libc6-dev-riscv64-cross
installed in-container (documented in the fixtures README).

Tests: kuna-analysis +4 units (per-arch idiom decode + collect_entries
contribution), kuna-console +3 e2e (verify_crossarch_entry_main.rs — bootstrap
each stripped fixture, load function sub_<main> → decompile → print C with NO
--addr → a real return-a0 body; actually run, not skipped). Gates:
make test 675/675 PARITY OK, make test-stages 158/158 PARITY OK,
make rust-test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
@mahaloz
mahaloz merged commit 600505f into main Jun 23, 2026
@mahaloz
mahaloz deleted the crossarch-entry-main branch July 29, 2026 08:01
mahaloz added a commit that referenced this pull request Sep 19, 2026
… every target the vararg rule admits

A closed format prototype also changes how P4 scores the argument trials of
the calls around it. On AArch64 and ARM32 firmware that added more wrong
arguments to neighbouring calls than it removed (an x8 of 0 ahead of the real
arguments; iproute2 ip's parse_rtattr losing its len), while on x86 every such
change removed a phantom. static now resolves at load on x86 only; full still
resolves on every target VarargAbi admits. Stage passes 24-26 pin AArch64
default == off and full typed; #13/#19/#23/#28 pin ARM the same way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 19, 2026
… every target the vararg rule admits

A closed format prototype also changes how P4 scores the argument trials of
the calls around it. On AArch64 and ARM32 firmware that added more wrong
arguments to neighbouring calls than it removed (an x8 of 0 ahead of the real
arguments; iproute2 ip's parse_rtattr losing its len), while on x86 every such
change removed a phantom. static now resolves at load on x86 only; full still
resolves on every target VarargAbi admits. Stage passes 24-26 pin AArch64
default == off and full typed; #13/#19/#23/#28 pin ARM the same way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Oct 1, 2026
…enamed away and given away

Two holes in the batch rules:

- `name v2 tmp`, `name v1 v2`, `type v2 ...`: the printed reading of `v2`
  picked the local already renamed to `tmp`, silently. When the variable
  printed under an identifier was renamed away earlier in the batch and an
  earlier directive gave that identifier to another local, the directive
  is now rejected naming both.
- The vN allocator ignored name-locked Symbols, so after `name v1 v3` +
  `name v3 v1` an untouched local also took `v1` and the printer pushed
  the caller's `v1` to `v1_1`. Every default now skips a name a
  name-locked local Symbol holds; with no such Symbol the numbering is
  unchanged (byte-identical over 2,336 corpus functions).

calleenamedlocals' s4 relied on that collision: it now renames both slots
to `w` for the collision coverage, and asserts that `rename v2 v1` alone
leaves the caller's `v1` on the slot it named (#18, #19; stages baseline
re-recorded, two keys added). The console rename/retype commands get the
current function through one helper instead of a discarded read_symbol.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017cAUeUBnQ9xRA9oRJNGWjw
mahaloz added a commit that referenced this pull request Oct 1, 2026
…enamed away and given away

Two holes in the batch rules:

- `name v2 tmp`, `name v1 v2`, `type v2 ...`: the printed reading of `v2`
  picked the local already renamed to `tmp`, silently. When the variable
  printed under an identifier was renamed away earlier in the batch and an
  earlier directive gave that identifier to another local, the directive
  is now rejected naming both.
- The vN allocator ignored name-locked Symbols, so after `name v1 v3` +
  `name v3 v1` an untouched local also took `v1` and the printer pushed
  the caller's `v1` to `v1_1`. Every default now skips a name a
  name-locked local Symbol holds; with no such Symbol the numbering is
  unchanged (byte-identical over 2,336 corpus functions).

calleenamedlocals' s4 relied on that collision: it now renames both slots
to `w` for the collision coverage, and asserts that `rename v2 v1` alone
leaves the caller's `v1` on the slot it named (#18, #19; stages baseline
re-recorded, two keys added). The console rename/retype commands get the
current function through one helper instead of a discarded read_symbol.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017cAUeUBnQ9xRA9oRJNGWjw
mahaloz added a commit that referenced this pull request Oct 1, 2026
…enamed away and given away

Two holes in the batch rules:

- `name v2 tmp`, `name v1 v2`, `type v2 ...`: the printed reading of `v2`
  picked the local already renamed to `tmp`, silently. When the variable
  printed under an identifier was renamed away earlier in the batch and an
  earlier directive gave that identifier to another local, the directive
  is now rejected naming both.
- The vN allocator ignored name-locked Symbols, so after `name v1 v3` +
  `name v3 v1` an untouched local also took `v1` and the printer pushed
  the caller's `v1` to `v1_1`. Every default now skips a name a
  name-locked local Symbol holds; with no such Symbol the numbering is
  unchanged (byte-identical over 2,336 corpus functions).

calleenamedlocals' s4 relied on that collision: it now renames both slots
to `w` for the collision coverage, and asserts that `rename v2 v1` alone
leaves the caller's `v1` on the slot it named (#18, #19; stages baseline
re-recorded, two keys added). The console rename/retype commands get the
current function through one helper instead of a discarded read_symbol.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017cAUeUBnQ9xRA9oRJNGWjw
mahaloz added a commit that referenced this pull request Oct 1, 2026
…utput it was shown (#789)

## The problem

Two `--assert name` directives on two different register locals each work alone, but in one run the second is rejected with `No symbol named:`, and reversing them reverses which one fails. A swap (`name a b` + `name b a`) was worse: both came back `applied` and nothing changed.

```sh
cat > t.s <<'EOF'
.globl two_locals, observe
.type two_locals,@function
.type observe,@function
two_locals: push %rbx; push %r12; sub $8,%rsp; xor %ebx,%ebx; mov $7,%r12d
1: add $1,%ebx; imul $3,%r12d,%r12d; add %ebx,%r12d; mov %ebx,%edi; mov %r12d,%esi
   call observe; cmp $4,%ebx; jl 1b
   lea (%rbx,%r12),%eax; add $8,%rsp; pop %r12; pop %rbx; ret
observe: ret
EOF
cc -c t.s && ld -e two_locals t.o -o t
kuna decompile t two_locals --assert 'prototype observe void observe(int index, int sum)' \
  --assert 'name index iteration' --assert 'name sum accumulator'
```
```
int two_locals(void)
{
  int iteration; // ebx
  int sum; // r12d
...
warning: --assert "name sum accumulator" rejected: No symbol named: sum
```

## The fix

- Naming a register local no longer clears the analysis, which emptied the variables every later directive looks its identifier up in. Both surfaces rebuild the IR from the scope for the second pass anyway.
- An identifier now means the variable printed under it in the output the run started from, so directives on different locals work in any order and `name a b` + `name b a` swaps. An identifier that output does not contain may name what an earlier directive renamed a local to (`name v1 rc` then `type rc unsigned int`).
- When an identifier is both a printed name and a name an earlier directive gave another local, the directive is rejected as ambiguous and names both locals: `name v5 v4` then `type v4 int` gives `Ambiguous name: v4 is both the local printed as v4 and the local printed as v5 (now v4)`. The exception is a `name` whose new name was also printed, as in a swap or rotation; it renames the local printed under the identifier.
- The `vN` default for an untouched local now skips any name a name-locked Symbol holds. Before, after `name v1 v3` + `name v3 v1` an untouched third local also took `v1` and the printer pushed the caller's `v1` to `v1_1`.
- The console `rename`/`retype` commands and the in-process (`--json`) path share one resolver.
- Two register locals sharing a register at different widths (`char *s // rax`, `uint4 v1 // eax`) cannot both get a symbol: the second pass folds them into one variable (`s._0_4_ = 0`). The later directive is rejected and names the earlier one.

Behaviour changes beyond the fix:

- After `name v5 v4`, main applied a later `type v4 int` or `name v4 x` to the local just renamed `v4` (unless both were stack slots, where it rejected it); that batch is now rejected. `name v1 v2` + `name v2 v3`, with `v3` also printed, renames the local printed as `v2`, where main renamed the first local twice.
- On the stack, `name v2 credbuf` then `type v2 char[8]` now retypes `credbuf` instead of being rejected.
- Without any directive, a DWARF parameter or local named like a default (`v1`) is a name-locked Symbol too, so it keeps its name and the defaults skip it. Main printed `uint1 v1; uint8 v1_1;` for bash's `size_t v1`; now it is `uint8 v1;`. This renames locals in 5 of 3,107 bash O0 functions (names only); `ls` and `sort` at O2 and `sdiff` at O0 are byte-identical.
- The `calleenamedlocals` stage's `rename v2 v1` no longer collides (the caller's `v1` stays on the slot it named); its collision coverage now renames both slots to `w`.

## The tests

- `kuna-cli/tests/local_name_batch.rs` on a new fixture (`localnamebatch_x86_64`, source beside it): the reported pair in both orders, three renames, stack, register and mixed pairs, swaps and a rotation among three locals, rename-then-retype, and the width, ambiguity and overlap rejections, each run through the text and `--json` surfaces. Everything except the stack-pair control fails on main. A DWARF fixture (`dwarfvnames_x86_64`, C source beside it) checks that a source `v1` keeps its name.
- `tests/cli/two-register-local-names-in-one-batch.json`: the reported case; fails on main.
- `calleenamedlocals` #18/#19 (stages baseline re-recorded, two keys added) fail on main.

Fixes #784

🤖 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 14, 2026
…s, and a split cleanup (#1072 delta review)

- Restore the guard the round-2 rewrite dropped: once the slot is placed, an
  address formed into a live byte of the argument area outside it is a local
  the same `add esp` releases, and the sizing is declined. A frameless
  `push ecx` local passed as `Fill(&r)` before `Take(*p, r)` printed
  `Take(v1._0_12_,a0)`; it now prints `Take(*a1,a1[1],v1)` as with the option off.
- Decline a cleanup followed by another bare `add esp` before the next call,
  branch or return (`add esp,8; add esp,4`).
- Document the two shapes the stack cannot tell apart: one reservation larger
  than the class, and a dead pushed local above a trivially copyable aggregate.

Fixture msvcbyval_ce_i386 gains podfold, split and a plain-struct control,
with stage assertions #19-#21.

[AUTOMATED] change made by Claude Code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
mahaloz added a commit that referenced this pull request Oct 14, 2026
…s, and a split cleanup (#1072 delta review)

- Restore the guard the round-2 rewrite dropped: once the slot is placed, an
  address formed into a live byte of the argument area outside it is a local
  the same `add esp` releases, and the sizing is declined. A frameless
  `push ecx` local passed as `Fill(&r)` before `Take(*p, r)` printed
  `Take(v1._0_12_,a0)`; it now prints `Take(*a1,a1[1],v1)` as with the option off.
- Decline a cleanup followed by another bare `add esp` before the next call,
  branch or return (`add esp,8; add esp,4`).
- Document the two shapes the stack cannot tell apart: one reservation larger
  than the class, and a dead pushed local above a trivially copyable aggregate.

Fixture msvcbyval_ce_i386 gains podfold, split and a plain-struct control,
with stage assertions #19-#21.

[AUTOMATED] change made by Claude Code.

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

The callee walks were cached until `calleeargs` changed, but a walk also
ends a path at a call to a no-return name, which `noreturn_known`,
`gobounds` and `securitycheck` gate. Turning one off in a console session
left the earlier walks in place, so a by-value block stayed expanded on the
strength of a pop a fresh session no longer proves. The cache now keys on
all four.

byvalreuse_pe_i386 gains quit/qtake/exit; REPFRAMECOPY Noelo-Lab#19 and Noelo-Lab#8 fail
without this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz added a commit that referenced this pull request Nov 22, 2026
…t tail call off the entry depth

Themida (plain) computes every stack and VM-context address from the entry
stack pointer and other entry registers through mixed boolean-arithmetic
identities, with flags words of junk arithmetic mixed in and cancelled again.
The linear normal form and the one-variable three-point probe saw none of
them, so loads and stores went to unknown locations and the VM exit's return
target was lost (4 rows unresolved, 9 rows over budget).

- ExprArena::identity_probe decides `e == base + k` or `e == k` by
  evaluating the DAG at 96 fixed points (splitmix64, fixed seed) assigning
  every variable and every innermost boolean atom (as a free bit) at once:
  20 structured lane-edge points, 76 uniform; exhaustive at <= 8 open bits.
  affine_probe uses it for several variables and to confirm the
  one-variable answer when no atom is involved.  A per-node cache of 4
  quick points (ExprArena::quick_vals) rejects most values with no walk.
- Explorer::same_on_stack: two values whose difference is the constant 0
  by that test are no difference at a merge.
- ExprArena::decide_atoms: a guard, address or computed target has each
  atom an identity decides replaced (x == y with x - y constant; ordered
  compares of constants or of one pointer plus constants).
- Linear form: zext(b ^ 1) == 1 - zext(b) for a boolean b.
- PushanTarget::user_stack_clear_bits: a second identity run with the
  stack pointer's top bits clear (Windows x86 without
  IMAGE_FILE_LARGE_ADDRESS_AWARE: bit 31; Windows x64: bits 47-63); used
  answers are counted and the header says the function "assumes the stack
  lies where the platform puts a user-mode stack".
- Explorer::misplaced_tail_call: a tail call (to a function or through an
  import slot) is accepted only with the stack pointer at its entry value;
  otherwise the exit stays unresolved and the header counts it
  (newstar_backdoor_themida ended at WSAStartup without a warning).

Fixture pushan_vm2_x86_64: f_mba (arguments read through an MBA identity
over rbp, rdx and rbx; exit behind an opaque predicate on rsp mixed with the
result) and f_spbit (an exit on bit 16 of rsp whose other arm jumps to fin
with the VM frame pushed).  bin-t1-final2 prints garbage loads plus a bogus
`fin(...)` path for f_mba with no warning, and accepts f_spbit's arm as a
tail call; now `return a0 + a1;` and an incomplete header.  Stage
kuna-pushan-sound #19-#21 recounted, #24, #25 new; baseline-stages
re-recorded (4957).  Spec 02 2.11: identity test, platform stack, tail calls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQR2hseBprKvbvZRUv
mahaloz added a commit that referenced this pull request Nov 24, 2026
… context accesses keep their cells memory

[AUTOMATED] A devirtualized body that still reads or writes the
protector's own memory computes with VM state as if it were program data.
Before, nothing said so: newstar_infect_themida, just_if_themida,
netsky_themida and zlib_themida (and, run to completion, libpng/smt/
netsky/zlib themida) printed with no incomplete warning.

- warn_protector_state (kuna_pushan.rs), run once the body is decompiled
  next to warn_unshown_escapes: counts, over the final ops, reads/writes
  of memory inside PushanProgram::protector (the candidate interpreter
  sections the exploration ran VM code in) and loads/stores whose address
  is a constant inside them plus an offset; MULTIEQUAL and INDIRECT/COPY
  that keep a location in place count nothing, and import slots a call
  went through (PushanProgram::slots) are the program's own. Header:
  "pushan: incomplete: N reads and M writes of the protector's own memory
  left in the body". No option: a strict correctness report.
- Emitter::access_window: an access the emulation could not place whose
  address is a constant inside the protector's sections plus terms with
  bounded possible bits blocks privatization of every cell of that window,
  so a VM cell an unplaced access may reach is never split between a
  private register and memory.
- Data (48 targets, default; Tigress sub30): with the net alone (no
  fixes) it fires on exactly the four unwarned WRONG Themida rows above
  and on already-warned rows; never on a VMProtect row, a SAME/WEAKER
  Themida row (newstar_backdoor, blaster dolphin/tiger, just_if
  dolphin/tiger, loop) or a Tigress sample.
- Fixture f_ctxi (two context cells, one read at an offset the argument
  selects) and stage assertion #31; #19 count 4, #20 count 24. Baseline
  5047.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
mahaloz added a commit that referenced this pull request Nov 24, 2026
…ized body

[AUTOMATED] An unplaced store forgets only the regions of its address's
coefficient-1 variable bases (havoc_store), or only mutable image memory
when it has none. A store whose address depends on the entry stack pointer
or on another variable whose region the state holds, without that variable
being a forgotten base, therefore left that memory as it was: the
exploration kept reading the value from before the store and the emitter
folded it into the program. Such a store is now marked lost
(Emulator::reaches_kept, AccessRecord::lost); the emitter records the
overlay address of each live instruction whose lost store it kept
(EmitStats::lost_stores), and warn_lost_stores, run with the other
post-decompile checks, counts those a basic block of the final function
covers: "pushan: incomplete: N stores through an address the emulation
could not place on a path of the body". No option.

The block decides, not the store op: when the stale read is folded to a
constant the decompiler removes the store as dead and the body is false
with no trace of it. Fixture f_cell before the merge fix prints
`return 1;` (the program returns 2); a count of surviving store ops stays
silent there, the block count reports 1. Code the decompiler removed counts
nothing. Unplaced loads are not counted: their unknown is never folded, so
the overlay keeps the program's own load.

48 rows (default, with the merge fix): the warning appears on curl (22),
huffman (30), cairuh (1), blaster (7) and smt_no_solve (4) themida, all
already warned, and on blaster_dolphin_themida (1: a store over the frame
pointer and a merged 0/1 context flag); on none of the 24 rows classed
SAME and none of the Tigress 30 subset; C unchanged on all 48. Without the
merge fix it fires on zlib_themida (6). Fixture f_lost (stage #33): a store
at &v ^ (a0 & 8); #19 counts it. Stage baseline 5049. Spec 02 2.11 (havoc
paragraph, header warnings, fixture list).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant