Skip to content

Analysis-tier: AArch64 PLT import-name e2e (linked fixture) - #14

Merged
mahaloz merged 1 commit into
mainfrom
aarch64-plt-e2e
Jun 23, 2026
Merged

mahaloz merged 1 commit into
mainfrom
aarch64-plt-e2e

Conversation

@mahaloz

@mahaloz mahaloz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

AArch64 PLT import-name end-to-end (linked fixture)

src/s1_loader/elf_plt.rs::decode_aarch64 already decoded the AArch64 GNU ld
import veneer (per docs/missing-analyses.md §1), but the proof was synthetic:
the decoder was only unit-tested against hand-assembled veneer bytes. The x86
paths had a real linked binary console gate (verify_w11_elf_plt_names);
AArch64 had no linked fixture. A dev container with the AArch64 toolchain +
linker (aarch64-linux-gnu-gcc 11.4.0) makes the linked build possible in-env
(unlike the still-blocked ARM decode e2e — no ARM/Thumb linker on host).

BEFORE

PLT decode unproven on AArch64 — no linked fixture. The AArch64 arm of
decode_plt_section was exercised only by aarch64_plt_decode against synthetic
bytes. (Confirmed by temporarily stubbing the arm: main then renders the
PLT-stub placeholders.)

unsigned long main(unsigned int a0)
{
  sub_4004d0("hello");
  sub_4004e0(0x400670,a0);
  return 0;
}

AFTER

Linked AArch64 binary plt_aarch64 (ET_EXEC, Machine AArch64, dynamic; .plt +
.rela.plt + DT_PLTGOT), built aarch64-linux-gnu-gcc -O0 -no-pie. main's
bl 0x4004d0/bl 0x4004e0 resolve to the imported names via the veneer decode
(adrp x16, GOT_page; ldr x17,[x16,#lo12]):

unsigned long main(uint4 a0)
{
  puts("hello");
  printf("%d\n",(uint8)a0);
  return 0;
}

The new e2e decompiler/crates/kuna-console/tests/verify_aarch64_plt.rs (modeled
on the x86 gate) drives bootstrap_from_elf -> load function main -> decompile -> print C and asserts puts(/printf( render and sub_4004d0/sub_4004e0 are
gone. The test actually decodes (does not skip) — same specs-absent skip
guard as the x86 gate (needs the built AARCH64.sla).

No elf_plt.rs fix / gap

None needed. decode_aarch64 already handled this binary's veneer layout
correctly; the change is purely additive (new fixture + new e2e + README
provenance + Increment 19 log; elf_plt.rs is untouched).

Fixture

  • decompiler/crates/kuna-analysis/tests/fixtures/plt_aarch64 (9056 bytes),
    source plt_aarch64.c (main calls puts("hello") then printf("%d\n", argc)).
  • main=0x400604, puts@plt=0x4004d0 (GOT 0x411018), printf@plt=0x4004e0
    (GOT 0x411020); both R_AARCH64_JUMP_SLOT in .rela.plt. VMAs pinned as consts.

Gates

  • make test → 675/675 PARITY OK
  • make test-stages → 158/158 PARITY OK
  • make rust-test → green (verify_aarch64_plt 1 passed)

Additive real-ELF-path change → the XML datatest/stage gates are structurally
unaffected (the <binaryimage> bootstrap never runs the ELF loader).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb

Prove the elf_plt AArch64 path (s1_loader/elf_plt.rs::decode_aarch64) resolves
imports end-to-end on a real, linked, dynamic AArch64 executable. The decoder was
previously only unit-tested against synthetic veneer bytes — the x86 paths had a
real-binary console gate (verify_w11_elf_plt_names) but AArch64 had no linked
fixture. A dev container with the AArch64 toolchain + linker makes the linked
build possible in-env.

- New fixture decompiler/crates/kuna-analysis/tests/fixtures/plt_aarch64
  (9056 bytes, ET_EXEC, Machine AArch64, dynamic; .plt + .rela.plt + DT_PLTGOT),
  built aarch64-linux-gnu-gcc -O0 -no-pie from plt_aarch64.c (main calls
  puts("hello") then printf("%d\n", argc)). Standard GNU ld 16-byte veneer
  (adrp x16; ldr x17,[x16,#lo12]; add x16; br x17). main=0x400604,
  puts@plt=0x4004d0 (GOT 0x411018), printf@plt=0x4004e0 (GOT 0x411020).
- New e2e decompiler/crates/kuna-console/tests/verify_aarch64_plt.rs, modeled on
  the x86 gate: bootstrap_from_elf -> load function main -> decompile -> print C;
  asserts puts(/printf( render and the sub_4004d0/sub_4004e0 placeholders are
  gone. Same specs-absent skip guard (needs AARCH64.sla). Actually decodes
  (does not skip).

No elf_plt.rs fix needed — decode_aarch64 already handled this binary's veneer
layout. Purely additive (fixture + e2e + README provenance + Increment 19 log).

Gates: make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK;
make rust-test green (verify_aarch64_plt 1 passed). Additive real-ELF-path
change -> XML datatest/stage gates structurally untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
@mahaloz
mahaloz merged commit 8549670 into main Jun 23, 2026
@mahaloz
mahaloz deleted the aarch64-plt-e2e branch July 29, 2026 08:01
mahaloz added a commit that referenced this pull request Sep 27, 2026
…ages baseline +20 elemptr keys only (1430)

tiedphitrim #13/#14 and structsynth-locals #2 read a 4-byte field through an
inferred int8 * and pinned upstream's widened form (int4)v[1]; with elemptr on
the load stays 4 bytes, *(int4 *)&v[1]. Keys unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01V6bguCkPS65cu9ejj1fbpy
mahaloz added a commit that referenced this pull request Sep 29, 2026
… ^ ~ << to a sign-sensitive reader

A value that reaches a shift, divide, compare, widening or int-to-float
through an expression C types after it (usink + 1 >> 4) was still merged
into the global. Both walks now follow such expressions; P6 stops at an
explicit output (its own declared variable). New witnesses w_sadd,
w_xordiv, w_f, w_sidx, w_cond; stage assertions #11-#14.

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
…ot that reads it

ActionConditionalConst gives a RETURN a known constant through a COPY
and, like upstream, stored that COPY in the RETURN's slot 1. Slot 1 is
the return value only once return recovery has trimmed the RETURN; while
the output trials are still open the RETURN reads every trial register
(rax in slot 1, rdx in slot 2 on x86-64), and a constant known for rdx
replaced the rax slot. With condexeret holding recovery open one more
iteration, a function whose second RETURN is reached only when rdx == 0
printed `return 0;` there instead of the entry value (reviewer's
tworet7). The COPY now goes to the slot that actually reads the varnode,
which is slot 1 on a trimmed RETURN, as upstream.

Not behind an option: it only corrects a RETURN whose recovery outlives
the first mainloop iteration. With condexeret off, decompile-all over
5,422 fixture and 36,464 decbench functions is byte-identical to the
unpatched build. tworet, tworet1 (the one-branch reference) and tworet7
join tests/stages/kuna-condexeret.xml; the pre-fix build fails #4 and
#14 there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TzSHsg8KAakpogyVw5dtjG
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 7, 2026
…rption reaches past the slots taken

Clearing COPY_CONSTANT on every slot extend_unbounded takes also cut
upstream's own constant absorption short: `long a[6]` with a[0]..a[4]
constant and a[5] = x read on its own lost a[5] (`long v1[5]` plus a
scalar, the loop index printed past the array) where `off` prints [6].

Clear the mark only on the last slot taken, and only when upstream's
absorption would not reach past it without the option (some slot from
the array's last element through the last slot taken holds no constant
store it accepts). The -O0 cases (flag, counters, read unsigned) are
unchanged; where the chain is live the array is upstream's.

Stage test #14 (s6, gcc -O0) keeps [6] in every pass; baseline
re-recorded (14 new keys, none missing).

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
…rption reaches past the slots taken

Clearing COPY_CONSTANT on every slot extend_unbounded takes also cut
upstream's own constant absorption short: `long a[6]` with a[0]..a[4]
constant and a[5] = x read on its own lost a[5] (`long v1[5]` plus a
scalar, the loop index printed past the array) where `off` prints [6].

Clear the mark only on the last slot taken, and only when upstream's
absorption would not reach past it without the option (some slot from
the array's last element through the last slot taken holds no constant
store it accepts). The -O0 cases (flag, counters, read unsigned) are
unchanged; where the chain is live the array is upstream's.

Stage test #14 (s6, gcc -O0) keeps [6] in every pass; baseline
re-recorded (14 new keys, none missing).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39
mahaloz added a commit to sjkim1127/kuna that referenced this pull request Nov 23, 2026
calleefloatreads_armhf.o (clang-assembled Cortex-M4F, recipe in its .s) is
fmodf handing __ieee754_fmodf its own s0 and s1, where the callee reads s0
and only spills s1. kuna-calleefloatreads.xml Noelo-Lab#14 pins inner2(a0,a1); the
submitted rule printed inner2(a0). Chapter 04 says when the rule defers to
calleearitybody.

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