Skip to content

Analyzer-tier port: bring Ghidra's Java analysis layer to kuna-analysis (Increments 1–17) - #10

Merged
mahaloz merged 25 commits into
mainfrom
analysis-port-noreturn
Jun 23, 2026
Merged

mahaloz merged 25 commits into
mainfrom
analysis-port-noreturn

Conversation

@mahaloz

@mahaloz mahaloz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Ports Ghidra's Java analyzer / loader tier (the "Run Analysis" layer) into the Rust
kuna-analysis crate, feature by feature, each faithful to its upstream analyzer and each with a
testcase. Started from the ElfDefaultGotPltMarkup example and built out the rest.

Method: a research workflow mapped the engine commit APIs + deep-read the analyzers; a planning
workflow produced a wave-organized execution plan; the passes were then implemented as parallel
worktree sub-agents and integrated sequentially with all three gates green after each.

What landed (13 increments — see docs/analysis-port-log.md)

Foundation + Wave 1 (pure additive passes):

  • Foundation — generic AnalysisOutput → engine commit seam in bootstrap_from_elf
    (commit_analysis_output), bound to the real-ELF path only; read-only markup on the ELF path.
  • No-return (NoReturnFunctionAnalyzer) — vendored ElfFunctionsThatDoNotReturn; rejected() → printf(...); exit(1); (dead code gone).
  • Demangling (GnuDemanglerAnalyzer) — cpp_demangle+rustc-demangle; foo::Bar::baz(...). Uncovered + fixed a cross-scope call-resolution gap (query_call only searched global scope).
  • Library prototypes (ApplyDataArchiveAnalyzer) — built-in libc signature table; puts("Username: ").
  • DWARF (DWARFAnalyzer, via gimli) — names + typed signatures: elaborate_debug_symbol(char *…).
  • Entry discovery + .eh_frame (EntryPointAnalyzer/GccExceptionAnalyzer) — e_entry + init arrays + FDE starts + _start→main + prologues → sub_1405 (main) decompiles in a stripped binary without --addr.
  • Source-language detection (SourceLanguageAnalyzer) — gates the Rust no-return wildcard list.
  • String-literal detection (StringsAnalyzer) — see the printer change below.
  • Address-tables (AddressTableAnalyzer, disabled-by-default, Ghidra parity); AIF + the operand-reference family documented ⛔ infeasible-at-tier.

Wave 2/3 (engine seams):

  • ARM/Thumb markers (ArmSymbolAnalyzer) — $t/STT_FUNC-LSB → TMode context paint (new commit arm, no-ops on non-ARM).
  • format-string parser (FormatStringAnalyzer, parser half A; B deferred).
  • call-fixups (CallFixupAnalyzer) — auto-tags cspec <callfixup> targets; mcount dissolves e2e.
  • No-return × demangle — no-return resolves by address (via PLT stubs) so demangled C++ symbols (std::terminate) flag.
  • Printer change — renders a pointer-to-readonly-char-array symbol as the string literal (Ghidra behavior), so s1_strings is re-enabled and puts("Username: ") works with the data symbol present, including non-libproto strings. 675/675 + 158/158 byte-identical.
  • Per-run --option gating — analysis commit deferred to read symbols (after options); all 8 passes flippable via --option/kuna catalog (settables 23→31), default-on (addrtable off).

Completeness + downstream compatibility (documented)

  • docs/analysis-port-log.md includes a full inventory classifying all 142 Ghidra *Analyzer.java as ported / inherited-by-engine / out-of-scope — the relevant ELF set is covered.
  • The downstream question is analyzed: adding analyzer logic does not break kuna as a Ghidra-front-end drop-in — the C++ decompiler protocol is pull-based (ArchitectureGhidra queries the client) and kuna's passes bind only to the standalone ELF path the protocol never uses.

Deferred frontier (the plan's gate-off / spike items)

format-string-B (decompile-loop varargs override), DWARF subtask-3 (stack-local ScopeLocal map — engine spike), and the arch-markers decode e2e / MIPS $gp (need off-host LINKED ARM/MIPS fixtures).

Gates

make test 675/675 PARITY OK · make test-stages 158/158 PARITY OK · make rust-test green · kuna catalog --check OK — verified after every increment. New fixtures (dwarf_stripped, switchtab, rust_hello, arm_thumb_le32.o, mcount, cpp_noreturn) are checked in with provenance. New deps gimli/cpp_demangle/rustc-demangle documented as dependency-substitution LOSSes.

Docs: docs/analysis-port-log.md (process log + inventory), docs/analysis-port-plan.md (the wave plan + deferred frontier), docs/missing-analyses.md, docs/agents.md (test-stages promoted to a required gate).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD

mahaloz and others added 25 commits June 22, 2026 21:35
…ionAnalyzer)

Begin porting Ghidra's Java analyzer/loader tier into kuna-analysis, feature by
feature. This lands the foundation that unblocks every later pass, plus the first
pass on it (no-return), each with tests.

Foundation (engine.rs):
- bootstrap_from_elf reads image bytes once, runs run_default_analyses over the
  parsed object, applies read-only markup (new on the ELF path; load-bearing for
  future string rendering), and commits the merged AnalysisOutput via the new
  commit_analysis_output (function/data/entry/no-return fact kinds wired against
  the verified engine APIs). Bound to the real-ELF path only -- the XML datatest
  path never runs analyses, so 675/675 parity is structurally untouched.

No-return (kuna-analysis/s1_loader/noreturn.rs):
- Port of NoReturnFunctionAnalyzer ("Known") + the verbatim ElfFunctionsThatDoNotReturn
  list (vendored at kuna-analysis/data/). Faithful matcher: strip ALL leading '_',
  exact-then-wildcard, namespace guard (global/std only). Commits via
  query_global_function -> Database::set_function_no_return.
- fauxware `rejected` collapses from dead fall-through to `printf(...); exit(1);`.
- The flow-based "Discovered" analyzer is documented infeasible at this tier.

Docs: new docs/analysis-port-log.md (process log, work-list, downstream-compat
analysis, deferred option-gating decision); missing-analyses.md + PROGRESS.md updated.

Tests: 5 unit tests; make test PARITY OK (675/675); make rust-test green;
kuna catalog --check clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…strings pass

Port Ghidra's StringsAnalyzer as the s1_strings AnalysisPass: scan
allocated+initialized ELF sections for NUL-terminated ASCII strings
(min length 5, require-NUL-end, ASCII charset), emit a StringFact per
find, and commit a typelocked char[N] data symbol at each address.

LOSS: omits Ghidra's n-gram trigram false-positive model (model file
not in tree, not portable); substitutes printable+NUL-terminated+min-5.
Over-accepts vs Ghidra; harmless for real literals.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…s resolve)

Demangle places `foo::Bar::baz` into the nested `foo::Bar` scope, which exposed a
latent limitation: the call resolver (query_call + the no-return/inline/inject
variants in decompile_drive.rs) searched only the GLOBAL scope's address map, so a
namespaced callee resolved to `sub_<addr>` (worse than the mangled name). C++
`Scope::queryFunction(Address)` spans the scope tree.

- Add Database::find_function_across_scopes + function_display_name_across_scopes
  (returns the fully-qualified `ns::base` name) + no-return/inline/inject cross-scope
  variants.
- Switch the four query_call* resolvers to them.

Result: cpp_mangled `main` now renders `foo::Bar::baz(&v1,0x2a)` (fully qualified)
instead of `sub_401136`, and `__stack_chk_fail()` is correctly no-return. Identical
for flat global names, so the 675 datatests are unaffected.

Also documents increment 2 (demangle + strings, fanned out) in analysis-port-log.md,
including the honest strings verdict (typed char[] globals render as `s_<addr>`; the
inline string literal is gated on the upcoming library-prototype pass).

make test PARITY OK (675/675); make rust-test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…string literals

Port of ApplyDataArchiveAnalyzer as the s1_protos LibProtoPass: a built-in table of
~25 common libc signatures (puts(char*), printf(char*,...), strcmp, malloc, memcpy,
...) -- a faithful minimal stand-in for Ghidra's binary .gdt archives. For each table
name present as a function, build PrototypePieces from the arch type factory and emit
it; the commit seam parks each on its callee via set_function_prototype_pieces, so
ActionDefaultParams copies the signature and the argument constants get typed.

Headline result: typing `puts`'s arg `char*` (+ the read-only markup from the
foundation + the already-ported StringManager) renders the literal:
  fauxware main:     puts("Username: "); puts("Password: ");
  fauxware rejected: printf("Go away!");

Key finding (documented in docs/analysis-port-log.md, Increment 3): kuna renders
string literals via type-driven rendering (char* + readonly + StringManager), NOT via
Ghidra's plant-a-string-data-object mechanism. kuna's printer renders a constant that
maps to a named global symbol as that symbol's NAME (s_400915), which SHADOWS the
literal -- so the s1_strings pass (a faithful StringsAnalyzer port) actually BLOCKS the
literal and is kept but disabled by default. A/B verified. Re-enabling it cleanly needs
a printer change (render a pointer to a readonly char-array symbol as the literal).

- pass.rs: AnalysisOutput gains a `prototypes` field.
- engine.rs commit_analysis_output: park each prototype on its callee.
- passes.rs: register LibProtoPass; s1_strings disabled with rationale.

kuna-analysis 34 unit tests; make test PARITY OK (675/675); make rust-test green;
kuna catalog --check clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…s a gate

- analysis-port-log.md: add an exhaustive accounting of all 142 non-test Ghidra
  *Analyzer.java classes (ported / inherited-by-engine / deferred-gap / out-of-scope),
  answering "is this every analysis?" -- no, ~4 ported + ~11 inherited + ~15 real
  ELF-relevant gaps deferred + ~112 out of scope.
- agents.md (CLAUDE.md/AGENTS.md): promote make test-stages to a required gate alongside
  make test + make rust-test. (Rebased onto #9: test-stages is now 158/158 PARITY OK, so
  the gate bar is simply "no failures".)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…waves)

Add docs/analysis-port-plan.md — the how-to-finish plan, generated from a 13-agent
planning workflow (each deep-read its assigned Ghidra analyzer + the kuna seam):

- 4 dependency-ordered WAVES: wave 0 foundation (vendor 8 fixtures + additive
  AnalysisOutput fact fields + gimli dep); wave 1 pure additive passes (eh-frame,
  entry-disc, sourcelang, ruststring, addrtable[disabled], dwarf-1/2, + doc-only
  aggressive-disasm/operand-refs) — max parallelism, zero parity-gate risk; wave 2
  engine/console-touching (arch-markers, callfixup, formatstring-A) — sequential
  gated integration; wave 3 highest-risk solo seams (printer string-literal arm,
  per-run option gating, noreturn x demangle, formatstring-B, dwarf-3).
- Cross-cutting prerequisites, the new fixtures to vendor (+ build commands),
  the fan-out/integration protocol (branch-from-main gotcha, 3-gate per-agent
  contract, sequential gated integration, which tasks are solo/human-gated), and
  ranked parity-gate cautions (printer change is THE risk; most passes are
  structurally safe).
- Appendix: 12 ready-to-execute per-task briefs (Ghidra source, approach, fixture,
  runnable testcase, deps, engine changes).

Notable scope calls: aggressive-disasm + operand-refs are doc-only ⛔ (infeasible at
the analysis tier / low payoff); ruststring folds into sourcelang; dwarf-3 (stack
locals) and formatstring-B are spike-then-defer engine changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
Foundation for the wave-1 analyzer passes (per docs/analysis-port-plan.md):
- dwarf_stripped_x86_64: cc -g then `objcopy --wildcard --strip-symbol='*'` (empties
  the symbol table, KEEPS .debug_* — so DWARF is the sole name source for add_values/
  compute/main). For s1_dwarf names + typed-signature recovery.
- switchtab_x86_64: gcc -O1 -no-pie, dense switch(0..7) -> absolute 8-byte jump table
  in .rodata at 0x402008. For the addrtable pass.
README updated with provenance + the VMA-pinning note.

(Wave-1 passes also reuse the existing cet_pie_x86_64 [.debug_info], fauxware [.eh_frame],
and stripped_dynamic_x86_64 fixtures. New AnalysisOutput fact fields + gimli dep land in
their own task worktrees, not here.)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…rand-refs scope decisions

addrtable: new s1_addrtable module porting Ghidra's AddressTableAnalyzer
(absolute pointer-table discovery). scan_address_tables() finds runs of
consecutive pointer-width values that all land in an executable section;
emits Data symbols + readonly ranges, never code entries. Registered
DISABLED-by-default in passes.rs (Ghidra setDefaultEnablement(false) +
false-positive risk), mirroring s1_strings. 7 unit tests over the
switchtab_x86_64 fixture confirm the scanner finds the 8-entry jump table
at vma 0x402008 (all elements in .text). NOT switch recovery (inherited S2)
and NOT roadmap-#9 post-typing refinement (engine S2) - only the
application-layer pointer-table scan.

aggressive-disasm + operand-refs: doc-only out-of-scope decisions
(infeasible-at-tier). AIF needs a post-disassembly Listing/FunctionManager
(>=20 found fns) + PseudoDisassembler; off-by-default upstream; subsumed by
entry-disc + eh-frame. Operand/scalar reference markup needs a
Listing/ReferenceManager absent at this tier; products subsumed by
strings/jumptables/entry-disc; the scalar->char* idea is blocked by the
same printer/MapGlobals shadowing as s1_strings. No producing pass.

Docs: analysis-port-log.md Increment 4 + work-list rows + inventory
reclassification; missing-analyses.md sections 4/6/7 + roadmap table.

Gates: make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK;
make rust-test green; kuna-analysis 41 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
New fused EntryDiscoveryPass (s1_entry) ports the feasible subset of Ghidra's
EntryPointAnalyzer/ExternalEntryFunctionAnalyzer/FunctionStartAnalyzer plus the
GccExceptionAnalyzer .eh_frame FDE-start oracle into one additive pass. Fills
only AnalysisOutput.entries; the existing commit seam names + adds each VMA.

Five oracles (unioned, exec-section-validated, funcsym-deduped):
1. ELF e_entry
2. DT_INIT/DT_FINI + INIT_ARRAY/FINI_ARRAY pointer tables
3. .eh_frame FDE pcBegin (hand-ported CIE/FDE walk + DW_EH_PE decoder, no gimli)
4. x86-64 _start->main libc-start idiom
5. x86-64 gcc prologue byte patterns (DittedBitSequence matcher)

stripped_dynamic_x86_64: discovers main (0x1405) with no symbol; sub_1405
decompiles by name without --addr (new verify_s1_entry.rs e2e gate).
fauxware: FDE oracle yields all 7 known function starts.

Always-on (like noreturn/libproto), no stages.toml/option entry; catalog OK.
No engine change. 8 new unit tests + 1 e2e. Gates: kuna-analysis 43/43,
make test 675/675 PARITY OK, make test-stages 158/158 PARITY OK, rust-test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…a gimli

Port Ghidra's DWARFAnalyzer (DWARFFunctionImporter + DWARFDataTypeImporter) as a
pure kuna-analysis S1 pass over the .debug_* sections, substituting gimli for
Ghidra's hand-rolled DWARF parser (the same dependency-substitution LOSS as BFD ->
object). Implements subtasks 1+2:

- subtask 1 (names + globals): each defined DW_TAG_subprogram (DW_AT_low_pc,
  declaration-only skipped) -> SymFact{Function} at its entry VMA; CU-top-level
  DW_TAG_variable with a DW_OP_addr location -> SymFact{Data}. Reuses the existing
  symbols commit arm. Win on the new dwarf_stripped_x86_64 fixture (DWARF-only
  names): add_values/compute/main recovered without .symtab.
- subtask 2 (typed signatures): a DIE->Datatype mapper (faithful reduction of
  DWARFDataTypeImporter.getDataType, with a depth-3 trackRecursion cap for type
  cycles) builds PrototypePieces from the return-type DIE + formal-parameter
  children, emitted into AnalysisOutput.prototypes (existing libproto commit arm,
  no engine change). cet_pie: main calls elaborate_debug_symbol((char *)a1[1]) with
  the DWARF char* param type, int4 return -- engine alone emits undefined8/long.

subtask 3 (DW_OP_fbreg stack-local ScopeLocal map) is DEFERRED: a wave-3 engine
change (new locals fact + database/console commit path). DwarfPass already decodes
fbreg locations to None so wiring it later is purely additive.

gimli 0.33 added as a workspace dep (read+std, no default features); Cargo.lock
committed for offline-gate safety. New s1_dwarf module + verify_s1_dwarf.rs e2e.

Gates: make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK; make
rust-test green; kuna-analysis 36 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…rd list

Port Ghidra's SourceLanguageAnalyzer + the *SourceLanguage.existsIn predicates as
a pure detect_compiler(&object::File) -> Compiler (Gcc/Clang/Rustc/Go/Unknown) in
the new s1_sourcelang module: .comment "rustc version"/GCC/clang records, the
_R../_ZN..17h<hex>E Rust-mangled-symbol heuristic, .rodata RUST_SIGNATURES, and the
.go.buildinfo/.note.go.buildid Golang section keys. Run it once before pass
selection (passes_for(Compiler)) and, when the compiler is Rustc, parse the
vendored RustFunctionsThatDoNotReturn wildcard list IN ADDITION to the base ELF
list in the existing NoReturnKnownPass (faithful to noReturnFunctionConstraints.xml's
rustc arm) -- so a tail core::panicking::panic / handle_alloc_error /
rust_begin_unwind elides its dead fall-through, matched only for Rust binaries.

ruststring: only the detection half is portable; the str-slice split is infeasible
at this tier (boundaries come from post-disasm interior reference destinations the
analyzer tier lacks) -- documented, no split code.

Vendored a 2.5KB unstripped no_std rustc fixture (rust_hello_x86_64) carrying both
a rustc-version .comment and a _ZN..17h..E symbol. 44/44 kuna-analysis tests
(34 + 10 new). 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_01PoywQpWT2aEJgJiy7oHemD
…mSymbolAnalyzer)

Port the ARM/Thumb decode-mode (TMode) painting — the first analysis-tier fact
that touches the engine's processor context. Two upstream mechanisms, both as
additive ContextPaint facts:
 - ARM mapping symbols $t/$a/$d (ARM_ElfExtension.evaluateElfSymbol:166-196):
   $t -> TMode=1 (Thumb), $a -> TMode=0 (ARM); matched by name (STT_NOTYPE).
 - STT_FUNC odd-address (LSB=1 => Thumb) convention (ARM_ElfExtension:197-204 +
   ArmSymbolAnalyzer.java:48-100): paint TMode=1 at value & !1.

New s1_loader/arm_markers.rs (AnalysisPass id "arm_markers", always-on),
gated on object::Architecture::Arm (canAnalyze == processor==ARM). New
ContextPaint fact + field + merge in pass.rs; new commit step 6 in engine.rs
that paints TMode via prog.arch().with_context_db_mut(set_variable[_region]).

Gate-safety: the commit arm swallows the "var not registered" Err so painting
TMode on a non-ARM language is a faithful no-op; verified non-ARM (x86-64)
fauxware main decompile is byte-identical pre/post change. make test 675/675
PARITY OK, make test-stages 158/158 PARITY OK, make rust-test green.

Fixture: arm_thumb_le32.o (.o-unit-only; no ARM linker on host) — the decode
e2e on a LINKED ARM exe + the Thumb-FUNC re-home are documented follow-ups.
LOSS: $d data runs are a no-op (no createUndefinedData at this tier); MIPS $gp
(tracked-register, not decode-mode) and MIPS16 ISA_MODE are scoped out.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
Port Ghidra's default-on CallFixupAnalyzer (install half only): a new
s1_callfixup pass matches program FUNC names against the cspec's registered
<callfixup><target> set (the underscore-retried getCallFixupNameForFunction +
getTargetFixupMap), and the engine.rs commit seam tags each match with the
fixup's inject id (mirrors the IfcFixupApply body, guarded by Ghidra's
getCallFixup()==null check). The inherited inject/weave path then applies it.

Headline: gcc -pg's mcount/__fentry__ profiling call dissolves out of main.

- new s1_callfixup module (matcher + scan + 5 unit tests)
- pass.rs: CallFixupFact + call_fixups field + merge
- engine.rs: commit step 6 (resolve -> guard -> set_function_inject_id)
- database.rs: function_inject_id_for_symbol(sid) read accessor (the guard)
- passes.rs/lib.rs: register always-on
- fixture mcount_x86_64 (static -pg) + README; verify_s1_callfixup e2e gate
- docs/analysis-port-log.md Increment 8 + work-list row

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_01PoywQpWT2aEJgJiy7oHemD
…n symbols attach

The no-return pass matched on raw object-symbol names while the demangle pass
renamed the funcsym before install, so a mangled C++ no-return import like
_ZSt9terminatev (installed as std::terminate in scope std) was missed by the
commit's query_global_function. Approach (A): carry the symbol address on the
fact (NoReturnFact { addr, name }) and resolve it in the commit via
Database::find_function_across_scopes (the stable key across demangling), with the
name path as a fallback. The scan now also walks the PLT-stub install addresses
(elf_plt::resolve_plt_imports) so a UND import's real funcsym address is emitted.

Fixture cpp_noreturn_x86_64 (g++ -O0): fail() tail-calls std::terminate(); the
e2e gate verify_noreturn_demangle asserts void fail(void) with the no-return
warning and no dead fall-through. fauxware exit() regression preserved.

675/675 + 158/158 PARITY OK; rust-test green (3836 passed).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
… literal; re-enable s1_strings

Teach the C printer's SPACEBASE arm (op_ptrsub_ir) to render a pointer to a
readonly char-printable array symbol as the string literal (the Ghidra
behavior, mirroring PrintC::pushConstant's TYPE_PTR -> pushPtrCharConstant arm,
printc.cc:1842-1880), so a planted char[N] data symbol and the string literal
coexist instead of the bare symbol name shadowing it.

A/B-pinned (StringLiteralPass OFF vs ON over fauxware main) that the shadowing
point is the SPACEBASE op_ptrsub_ir arm: with the pass ON the planted char[N]
symbol promotes the puts() constant into a global PTRSUB(spacebase, 0xADDR)
reference whose sym_off<=0 branch emitted the bare name (s_400915). The fix
routes a whole-symbol (off==0), pointer-value (!arrayvalue) reference whose
Symbol is a readonly char-printable TYPE_ARRAY through the existing
push_ptr_char_constant_ir literal path; every other symbol render is
byte-unchanged (tightly guarded). Refactored push_ptr_char_constant_ir to take
ptr_size: int4 (was ct used only for ct.get_size()).

Re-enabled StringLiteralPass in passes.rs. fauxware main now renders
puts("Username: ")/puts("Password: ") with s_400915/s_400920 registered
(coexistence); a non-libproto'd string call also renders the literal via the
new route. New e2e gate verify_s1_strings.rs.

Parity held: make test 675/675 PARITY OK (byte-identical); make test-stages
158/158 PARITY OK (byte-identical); make rust-test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…read-symbols, after options)

Resolves the deferred conflict #4: each kuna_analysis pass is now flippable per
decompilation via --option <id> on|off and discoverable in `kuna catalog`.

- Defer the analysis commit out of bootstrap_from_elf's eager body: stash the
  per-pass AnalysisOutput (run_default_analyses_per_pass) + code space on the
  ConsoleProgram and commit it, gated, in IfcReadSymbols (read symbols) via
  ConsoleProgram::commit_pending_analysis. read_loader_symbols + readonly markup
  stay eager (the commit-after-symbols invariant is preserved). IfcFuncload/
  IfcAddrrangeLoad commit as a fail-open safety for sessions that skip read symbols.
- Reorder kuna-cli build_script: emit `option ...` lines before `read symbols`.
- Register 8 pass-gate settables (noreturn_known, libproto, strings, entry_disc,
  arm_markers, dwarf, callfixup, addrtable) in stages.toml + KUNA_OPTION_NAMES +
  set_kuna_option (8 analysis_* bools on Architecture; default-on except addrtable
  off, Ghidra AddressTableAnalyzer parity). No live_field; live state via
  kuna_live_value. settable count 23->31; stage_catalog.json fixture regenerated.

Default behavior unchanged (all-on except addrtable). Real-ELF path only — the XML
datatest path stashes nothing, so the gated commit is a no-op there.

Gates: make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK;
make rust-test green; kuna catalog --check catalog OK. Proof:
`kuna decompile fauxware rejected --option noreturn_known off` reintroduces the
dead fall-through (exit() renders as returning); default is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
Recover per-function named, typed stack LOCALS from DWARF (DW_OP_fbreg
DW_TAG_variable/formal_parameter) and install them into the function's
ScopeLocal, so a -g binary renders `int accumulator` instead of `local_10`.
Port of DWARFFunctionImporter.processSubprogram's local commit +
DWARFVariable.readLocalVariableStorage.

Spike finding: the ScopeLocal install seam IS cleanly reachable with NO
shared-engine-path change. ScopeLocal is per-Funcdata (rebuilt each decompile),
but the console already carries hand-typed `map addr` stack symbols across that
rebuild via mapped_symbol_specs -> seed_mapped_symbols -> ScopeLocal::add_symbol,
threaded as the mapped_symbols arg of decompile_func_full_with_override_dyn.
DWARF locals plug straight into that proven path.

- pass.rs: new LocalFact{func_addr,name,type_,stack_offset} + AnalysisOutput.locals.
- s1_dwarf: decode single-DW_OP_fbreg locations (simple_fbreg_location + a
  self-contained SLEB128 reader), type each via the existing DIE->Datatype mapper,
  apply the per-arch static call_frame_cfa (stack_offset = cfa + fbreg; x86-64=8,
  transcribed from x86-64.dwarf) — collect_fbreg_locals.
- engine.rs: commit arm 8 parks locals by entry VMA on ConsoleProgram.dwarf_locals;
  dwarf_locals_for(addr) builds the map-addr stack-symbol specs (typelock|namelock).
- ifacedecomp.rs: IfcDecompile appends dwarf_locals_for(entry) to mapped_symbols.
- Gated real-ELF DWARF only (dwarf pass flag); XML datatest path parks none. No HashMap.

New stacklocal_x86_64 fixture (address-taken local that survives) proves the render:
compute_sum shows `int accumulator`/`int counter`, not `local_10`/`local_c`.
cet_pie's own locals are write-once spill slots the engine eliminates (install
correct, no Varnode binds — documented).

make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK; make rust-test
green; kuna catalog --check clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
Mirror the Rust no-return work for Go: vendor GolangFunctionsThatDoNotReturn
verbatim from Ghidra and match it (in addition to the base ELF list) when
detect_compiler == Go, faithful to noReturnFunctionConstraints.xml's
`compiler id="golang"` arm. Generalize NoReturnKnownPass from { rust: bool } to
{ compiler: Compiler } so per-compiler list selection mirrors Ghidra's per-arm
selection; passes_for now uses NoReturnKnownPass::for_compiler(compiler). Same
pass id (noreturn_known), so the --option gate and catalog are unchanged.

Go ELFs are unavoidably large (~1.1 MB), so no fixture is vendored: the real-Go
e2e builds a tiny Go program at test runtime (guarded on `go` present, skips
otherwise) and asserts both detection (Compiler::Go) and matching
(runtime.gopanic/throw/goexit.abi0 flagged under the Go arm, not the C arm).
List-parse/matching is pinned hermetically (no fixture, always runs).

Completeness sweep: with the Go list in, every feasible-at-tier, decompiler-
relevant ELF analyzer is ported. The only near-miss (naming .init_array/
.fini_array elements _INIT_<i>/_FINI_<i>) is reported as a follow-up — it is a
cross-cutting entries-fact-type change for a listing-cosmetic naming win, not
small+additive. ExternalEntryFunctionAnalyzer, GOT/PLT disasm, IFUNC, symbol
versioning, MachO/PE no-return, ExternalSymbolResolver, etc. confirmed
already-covered / infeasible-at-tier / out-of-scope. See docs/analysis-port-log.md
Increment 14.

Gates: make test 675/675 PARITY OK; make test-stages 158/158 PARITY OK;
make rust-test green (exit 0, 226 ok / 0 failed); kuna catalog --check OK;
cargo test -p kuna-analysis 93 passed / 0 failed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
…lf B, gated off)

The deferred half of the format-string port (Increment 9 did the parser, half A):
the decompile->inspect->override->re-decompile loop that types a printf/scanf
call's variadic arguments per call site. FormatStringAnalyzer is genuinely
DecompilerDependent (the per-call-site format constant only exists after lift),
so this is the kuna analog of Ghidra's ParallelDecompiler + PcodeFunctionParser
+ HighFunctionDBUtil.writeOverride, living in the console IfcDecompile driver,
not a load-time AnalysisOutput pass.

SPIKE: the override+re-decompile seam is cleanly reachable -- every primitive
already exists (the `override prototype <addr> <decl>` console command is the
hand-driven analog): pending_proto_overrides -> Override::insert_proto_override
-> applyPrototype at flow time. The only new code is the pcode-walk + the loop.

- s1_formatstring/apply.rs (pure, unit-tested): classify_variadic_call (Ghidra
  VARIADIC_SUBSTRINGS / INPUT_FUNCTION_SUBSTRING) + build_override_pieces
  (createParameters/initSignature: fixed params ++ format-derived types,
  first_var_arg_slot = -1).
- kuna-console IfcDecompile: extract_format_string_overrides walks CALL ops,
  classifies callees, reads the format constant at the format slot
  (getInput(getParameterCount()) -- resolving kuna's derived format-pointer
  varnode through its defining PTRSUB/PTRADD/COPY/CAST op), reads the C string
  via read_loadimage_value, parses, builds the override, re-decompiles.
- Gate `formatstring` (default OFF, Ghidra setDefaultEnablement(false)): a new
  Architecture::analysis_formatstring bool + stages.toml + KUNA_OPTION_NAMES +
  set_kuna_option. Default-off => the loop is skipped and the decompile is
  byte-identical (it does NOT gate a load-time pass; IfcDecompile reads it).

Fixture fmt_x86_64 (printf("%d %s\n", argc, argv[0])): with `--option
formatstring on`, main renders printf("%d %s\n",a0,(char *)*a1) (the %d arg an
int, the %s arg cast to char*) vs the default untyped (uint8)a0,*a1.

Gates (default-off byte-identical): make test 675/675 PARITY OK, make
test-stages 158/158 PARITY OK, make rust-test green (kuna-analysis 92 + the new
console e2e gate verify_s1_formatstring), cargo test green, kuna catalog --check
OK. Updated the 4 settable-count tests (31 -> 32) + the stage_catalog.json /
assertions.md catalog goldens for the new option.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
Increment 14 of the analysis-tier port. Closes the two deferred siblings of
the Increment 8 arch-markers frontier.

MIPS $gp recovery (the register-VALUE tracking case): new s1_loader/mips_markers
pass (MipsMarkerPass, id mips_gp), the kuna analog of Ghidra MipsAddressAnalyzer.
Seeds t9 = func_entry per MIPS function (the assumeT9EntryAddress PIC jalr-t9
convention) as a tracked register value, so a PIC prologue's addu gp,gp,t9 folds
to the real $gp and $gp-relative GOT/.sdata loads resolve. Uses the
TrackedSet/TrackedContext API (create_set/get_tracked_default, consumed by
ActionConstbase in S3) via a new TrackedRegFact + commit-seam step 7 (the exact
IfcSettrackedrange recipe). MIPS-only; gate-safe (get_register_varnode Err
swallowed, no-op on non-MIPS, x86-64 byte-identical). The gp-direct seed is a
documented LOSS (needs Ghidra's lazy unknownValue propagator).

ARM Thumb-FUNC re-home: arm_markers now also emits a Function SymFact at the even
entry for an LSB-set STT_FUNC, so load function / a CALL resolves at the decode
address. Resolves the Increment-8 paint-only LOSS.

Fixture: linked dynamic mips_gp_le32 (mipsel-linux-gnu-gcc -O1 -no-pie); the
decode e2e runs in-env. The ARM decode e2e stays blocked off-host (no ARM linker).

Option mips_gp (default-on) added (stages.toml + KUNA_OPTION_NAMES +
analysis_mips_gp flag + kuna_live_value); catalog fixture + count tests bumped
31->32. make test 675/675, make test-stages 158/158 PARITY OK, make rust-test
green (3841), kuna catalog --check OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD
@mahaloz

mahaloz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Update — deferred frontier complete (Increments 14–17). The whole deferred frontier landed, plus a completeness sweep. All gates green throughout (make test 675/675 · make test-stages 158/158 · make rust-test · kuna catalog --check).

  • 14 — DWARF stack locals: DW_OP_fbreg locals install as named+typed stack vars via the existing seed_mapped_symbols/map addr seam → int4 accumulator;/counter instead of local_10.
  • 15 — Golang no-return + completeness sweep: GolangFunctionsThatDoNotReturn gated on Go detection; the sweep confirms every feasible-at-tier ELF analyzer is ported (ELF matches base+rustc+golang no-return lists).
  • 16 — format-string-B (gated off): --option formatstring on reads the printf format constant, installs a per-call-site proto override, re-decompiles → printf("%d %s\n",a0,(char *)*a1). Default-off is byte-identical.
  • 17 — MIPS $gp + ARM Thumb-FUNC re-home: tracked-register seam seeds t9 = func_entry (MIPS PIC ABI) so $gp-relative GOT loads resolve; ARM FUNCs now known at their even entry.

New options (settables 31→33): formatstring (off), mips_gp (on). New fixtures: stacklocal_x86_64, fmt_x86_64, mips_gp_le32 (+ Go built at test runtime).

Only two items remain, both non-engine / off-host: the ARM decode e2e (no ARM linker in CI/this env — the pass + .o unit test are done) and the cosmetic _INIT_/_FINI_ array-element naming (addresses already discovered by s1_entry). Everything else is engine-inherited or out-of-scope (non-ELF formats, Go pclntab, FID).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PoywQpWT2aEJgJiy7oHemD

@mahaloz mahaloz changed the title Analyzer-tier port: bring Ghidra's Java analysis layer to kuna-analysis (Increments 1–13) Analyzer-tier port: bring Ghidra's Java analysis layer to kuna-analysis (Increments 1–17) Jun 23, 2026
@mahaloz
mahaloz merged commit bd0236c into main Jun 23, 2026
mahaloz added a commit that referenced this pull request Aug 19, 2026
…delta-review findings

[AUTOMATED] The branch was RED on its own gate: `ghidra_sim_sort_grep_breadth`
(the #[ignore]d breadth test `make test-ghidra` and the CI gates job run with
`--include-ignored`) failed on tests/bug-repro/sort::sub_6370 with "NO <vardecl
symref> resolves against <localdb>".

ROOT CAUSE (a port gap, not a heuristic).  sub_6370 declares `char v1 [16]` and
`char v2 [24]`, two stack aggregates used ONLY as `memcmp(v1,v2,0x10)` — i.e.
reached exclusively through a `&sym` reference.  The whole HighVariable of such
a variable is the CONSTANT PTRSUB offset operand (one instance, const space,
is_constant=true, is_addr_tied=false), so `kuna_link_high_symbols` skips it at
the constant guard and `kuna_high_symbol_wire_id`'s re-derivation loop — which
only scans addr-tied instances — cannot see it either.  Both declarations fell
back to the varnode create index; 2 of 2, hence "wholesale".  The Symbols were
in <localdb> the whole time (v1/v2, cat -1, real ids).

`Funcdata::link_symbol_reference` copies the referenced Symbol's name, offset
and type onto that high but DROPPED its identity, where upstream
`Varnode::setSymbolReference` (varnode.cc:465) →
`HighVariable::setSymbolReference(entry->getSymbol(), off)` (variable.cc:283)
carries the Symbol itself.  The identity is now recorded
(`HighVariable::kuna_ref_symbol`, local scope only) and read by the
declaration's symref.  Deliberately a SEPARATE field from `kuna_link_symbol`:
that one feeds <high symref>, and such a high encodes class="constant", where
Java's HighConstant.decode does nothing with a mapped local symref — so nothing
is gained there, and keeping it out preserves the one-owner invariant
`ghidra_sim_faillog_high_symrefs_are_not_shared_with_params` asserts.

This also closes the pinned residual: PIN_FAILLOG_VARDECL_UNRESOLVED moves
[0,1,0] -> [0,0,0] (sub_3320's survivor was the same class).  Every declaration
in the corpus now resolves; the pin doc states ZERO is the contract.

TEST HYGIENE (a harness bug, fixed here).  The previous round's recorded
verification ran `cargo test -p kuna-ghidra --release` WITHOUT
`--include-ignored` — its log reads "ghidra_sim_sort_grep_breadth ... ignored"
— so the breadth test was never executed locally and nothing said so.
`make test-ghidra` now tees its output and fails on TWO canaries: the CI skip
canary (specs missing/unusable => every sim test skips and passes vacuously;
worktrees hit this because KUNA_SPECS/SLEIGHHOME do not reach the cargo
suites), and a breadth canary demanding the literal
"test ghidra_sim_sort_grep_breadth ... ok" line.  The breadth test itself now
asserts 0 unresolved PER TARGET (the generic "resolved > 0" gate only catches
wholesale breakage; a 20/20 -> 1/20 regression passed silently).

DELTA-REVIEW FINDINGS (batched):

 #2 HIGH `add_param_symbol` promoted ANY storage-OVERLAPPING symbol into
    parameter slot i.  Upstream `ProtoStoreSymbol::setInput` (fspec.cc:3150)
    does the opposite — it looks up BY SLOT and removes+recreates on an
    addr/size mismatch; it never promotes an unrelated local.  And this runs in
    ActionRestructureVarnode (standalone included) where
    `clear_unlocked_category_negative` only clears cat<0, so a wrong promotion
    is permanent.  Now categorizes only on an EXACT (addr,size) match; comment
    rewritten to the real mechanism and both failure modes (checkFullCommit's
    storage compare; getDatabaseParameter keying the DB slot off
    getCategoryIndex).
 #3 MED  WireSymbol::encode bypassed the 0-size-type filter added for scope
    symbols (MappedEntry.decode throws and Java discards the whole result).
    `kuna_link_high_symbols` now routes a 0-sized dtype to the HASHED shape
    (DynamicEntry.decode has no size check) and `WireSymbol::is_encodable` is
    the backstop in both the encode and the id set.
 #4 MED  <vardecl symref> was not filtered through the encodable predicate.
    Every branch of `kuna_high_symbol_wire_id` now passes
    `ScopeLocal::symbol_is_encodable` (new O(1) single-symbol form — the set
    build would run per declaration on every decompile).
 #5 MED  `kuna_apply_dynamic_recommendations` runs at the TOP of the naming
    pass, where the ported isNameUndefined guard is vacuous, and it CREATES a
    Symbol where upstream RENAMES one.  kuna fuses linkSymbols with the vN
    assignment into one walk, so there is no "after linking, before defaults"
    point to move it to; the equivalent guard is applied against the SCOPE
    instead — a hash landing on storage the walk will bind to a
    function_parameter, or to any Symbol with a defined name, is skipped.
    Also: find_varnode's `vnlist2[pos]` is a checked `.get()` (the hash is
    host-supplied), and the hardcoded budget of 8 carries the "deliberately
    not `dynamichashmax`" note.
 #6 MED  the WIRE arm of encode_high skipped the encodable_symbols guard;
    `encodable` is empty for a has_no_code() function, so class="local" +
    symref against a <localdb> never written is the HighLocal.decode
    hard-throw.  Wire arm now takes the same gate (falls to class="other").
 #7 LOW  Funcdata::clear() left kuna_wire_symbols / kuna_wire_symbol_for_high
    behind — HighVariableId-keyed maps outliving the arena that issued the ids.
 #8 LOW  declaration tokens carried `varref`; upstream emitVarDecl pushes an
    explicitly NULL Varnode, and the omission is load-bearing
    (ClangVariableToken.getHighVariable returns inst.getHigh() from inside its
    `inst != null` block and never reaches the parent-decl fallback).  Dropped;
    the create index remains the symref fallback.
 #9 LOW  slot skew: `to_pieces` compacts out params with no dtype while
    param_storage carried absolute rp.index.  Both now use the compacted basis.
 #10 LOW live rig: `len(before) >= 2` hard-failed on a one-local function (now
    >= 1, with a NOTE at 1), and the param rename target + its recorded old
    name now both come from the post-commit result.

Doc correction (reviewer-verified): checkFullCommit inspects the parameter
count, each categoryIndex and each storage — never the model name.  The C6
prose in docs/spec/00-overview.md claimed otherwise; corrected to "the storage
echo is the load-bearing half".  Spec prose also gains the &symbol identity
record, the vardecl encodable filter, and the dynRecommend placement
divergence; ghidra-integration.md's deferred list is re-cut.

Gates: make test 675/675 PARITY OK; make test-stages 484/484 PARITY OK;
make rust-test green; make check-spec OK; make test-ghidra green WITH the
breadth test proven to have run (11 sim tests, 6/6 breadth targets at
vardecl_unresolved=0).  C text byte-identical — c_lines 283/39/92 and every
other faillog pin unchanged.  No baseline re-pins, no options, no DIV rows.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC
mahaloz added a commit that referenced this pull request Sep 30, 2026
…eline on main 0729b8b (FLOATRET #1-#10 only)

Decompiled alone, logish cannot see what core and qnanf_ return, and the
-INFINITY constant beside them no longer makes it a float that converts
both calls by value; decompile-all still types it float.

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

Re-recorded on origin/main 3c08fcf plus this branch: the 10 FLOATRET keys are the only additions, none removed.

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
…only)

Re-recorded on origin/main 3c08fcf plus this branch: the 10 FLOATRET keys are the only additions, none removed.

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
…only)

Re-recorded with SLEIGHHOME set: 1680 = main's 1670 + the 10 FLOATRET keys, none missing.

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

Re-recorded with SLEIGHHOME set: 1683 = main's 1673 + the 10 FLOATRET keys, none missing.

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

Re-recorded with SLEIGHHOME set: 1683 = main's 1673 + the 10 FLOATRET keys, none missing.

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

Re-recorded with SLEIGHHOME set: 1683 = main's 1673 + the 10 FLOATRET keys, none missing.

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

The callee walk joined an exact stack pointer with one a stack-moving call
left unplaced and attributed the result to the callee's own code, so a short
wrapper with one path through such a call and one without was recorded as a
stack-moving helper itself. The label then reached its callers (callee-saved
registers clobbered, frame pointers lost), and a function's proven pop
depended on the depth at which the walk met it. The join now keeps the
imprecision with whichever side owns it.

Stage case kuna-calleepurge Noelo-Lab#10 (calleedepth_pe_i386, clean-room asm with its
recipe): outer's `ret 4` is proven through a chain that reaches an
SEH-framed function at the last walk depth, so the caller's next call reads
its own argument. Unit test on join(); stages baseline gains that key.

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 14, 2026
Re-record docs/baseline-stages.json on the merged tree (kuna-repframecopy
#8 renamed, #10-#13 added); corpus count 754.

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
A value shaped like the cookie (a global XORed with the stack or frame
pointer) that the body of an SEH function pushes for a call through a
pointer is a real argument, but the shed took it, and every argument
above it, for the cookie: `lookup2(key ^ esp, 7)` printed as
`lookup2()`, and under an EBP SEH frame with no cookie at all
`lookup(key ^ ebp)` printed as `lookup()`.

The op that stores the cookie into its slot must now be the prologue's:
in the block of a store of a stack address to fs:[0] (the link of the
registration record), before it. A store to fs:[0] that is not a link
(the epilogue's unlink) no longer counts as an SEH frame. The fixture
gains sehkey and sehebp (STACKCOOKIE Noelo-Lab#10, Noelo-Lab#11). STACKCOOKIE Noelo-Lab#7 also
accepts the key XORed with the address of a named local: when the cookie
never becomes the call's argument, its slot is mapped as a local, and
the stack pointer at the push is that local's address.

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

ARM vcmp/vmrs and AArch64 fcmp set NZCV=0011 for unordered operands, so
gt and ge are false for a NaN while le, lt and hi are true. The x86 guarded
fold only matched an OR of NaN guards, so nanignore stripped the V test from
Z || N != V and printed `a != b && !(a < b)`, true for a NaN.

fold_exact_conditions evaluates each outermost condition a NaN test feeds
for less, equal, greater and every unordered case, following ARM32's FPSCR
bit packing, and rewrites it to the one comparison (or its negation) it
equals. Strict correctness fix, no option. kuna-ucomiss-unordered Noelo-Lab#10 and
kuna-prefersplit pinned the old spellings; both now pin the exact form.

Automated change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mahaloz added a commit that referenced this pull request Nov 27, 2026
kuna-homespill-win64.xml gains two variadic int f(const char *fmt, ...)
shapes: MSVC /Od's, which spills all four registers and takes the address of
rdx's slot for va_start, and gcc -O2's, which saves rdx, r8 and r9 without a
va_start. Both keep only their named parameter (#9, #10; both printed four
parameters before). The stages baseline is re-recorded for the two new
assertions (5,578 to 5,580). Spec 04 describes the refusal.

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