Repository navigation
Listing/xref tier PR2: engine-invoke (flag-gated build at bootstrap) - #27
Merged
Merged
Conversation
PR2 of the Listing/xref tier (docs/listing-tier-design.md §1.3, §7 PR2): invoke the keystone from the engine at bootstrap, flag-gated on `arch.analysis_listing` (default OFF). PR0 built `Listing::build`; PR1 wired `--option listing` with `AnalysisCtx.listing` always `None`. PR2 makes the build fire behind the flag and populates `ctx.listing`. Wiring: - passes.rs: threaded `translate: &dyn Translate` into both drivers (`run_default_analyses_per_pass` — the live one — and, for signature symmetry, `run_default_analyses`). In each, before the pass loop: `let listing = arch.analysis_listing.then(|| Listing::build(&file, image, arch, translate, &seeds)); ctx.listing = listing.as_ref()`. The Listing is owned by the driver and outlives the pass loop (same lifetime shape as `file`). - New `pub fn listing_seeds(file)` = `existing_function_addrs ∪ collect_entries`, exec-section-filtered, sorted/deduped (design §3.1), from the pub(crate) s1_entry helpers. `pub` so the cross-crate verify gates use the exact driver set. - engine.rs: the `bootstrap_from_elf` driver call passes the engine's decoder as the 4th arg — `sleigh.base().unwrap().translate()` (a `&Sleigh`, `Sleigh: Translate`, coerced to `&dyn Translate`). Default-off ⇒ `.then(...)` is `None` ⇒ no decode work, `ctx.listing == None`, byte-identical to today. With the flag on the Listing is built but consumed by no pass yet (first consumer is PR6), so the decompiler output is unchanged. The build runs only on the real-ELF path; the XML datatest path never reaches the driver, so the 675/675 and 159/159 oracles are structurally untouched. Proof (specs built; tests ran, not skipped): - verify_listing_core.rs `listing_build_through_engine_driver_seeds`: bootstraps fauxware, builds the driver seed set via `listing_seeds`, runs `Listing::build` through the engine's real `&dyn Translate` — 21 seeds -> 21 functions, 228 instructions; `function_count() > 0`, `instruction_at(entry).is_some()`. - verify_listing_parity.rs `listing_on_is_byte_identical_to_off`: decompiles fauxware main with the flag off and with `--option listing on`, asserts the C is byte-identical (437 bytes). Gates: `make test` 675/675 PARITY OK; `make test-stages` 159/159 PARITY OK; `make rust-test` green; `kuna catalog --check` OK. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
…nvoke # Conflicts: # docs/analysis-port-log.md
mahaloz
added a commit
to borancar/kuna
that referenced
this pull request
Nov 14, 2026
…ious call The vtable's object was followed back through copies past intervening calls, so `mov esi,ecx; call f; mov eax,[esi]; push esi; call [eax+k]` (COM calls through ESI, and a C table through ESI) took ECX as the receiver although the earlier call clobbered it; the COM push check also compared two scans of different reach and missed the pushed interface. The object, the last push and EAX are now compared as values over the run of ops since the previous call, carried forward through copies. The vcall fixture gains comesi and crosscall (stage Noelo-Lab#26, Noelo-Lab#27, the custom test). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
sjkim1127
added a commit
to sjkim1127/kuna
that referenced
this pull request
Nov 20, 2026
…type A caller that hands its own entry argument registers straight to a direct callee printed the call with no arguments and became `(void)` whenever the callee had no `protoorder` statement: every single-function decompile, every stage test, and callees decompile-all had not reached yet. `passthrough` read only the statement. With nothing stated, `passthrough` now reads the callee's own body: the leading run of the call model's general-purpose argument registers whose low byte the complete entry walk reads for a value that reaches something (a register only spilled ends the run, so a variadic register-save prologue adds nothing), or that one of its direct calls' targets takes on the same terms. A call is extended only when the finished list reaches the end of that run, and not when the caller loaded the register after it with a value it may be passing (the `calleearitycut`/`calleearityscratch` boundary). The function's own variadic test no longer counts a register that is only pushed (clang's `push %rax`). Stage assertions that pinned the dropped spelling are corrected; the stages baseline is re-recorded for the renamed `passthrough` and `LIBCTYPES Noelo-Lab#27` assertions. No datatest assertion moves (675/675). Co-Authored-By: Claude Opus 5.5 <[email protected]>
mahaloz
added a commit
that referenced
this pull request
Nov 22, 2026
libpng's png_decompress_chunk (Ultra, plain VMProtect and Themida builds) lost `if (*a3 != size) ret = -7` and `if (ret == 1 && a1 - a2 != avail) png_chunk_benign_error(...)` after the second png_inflate call, with no warning. png_inflate gets &avail and the pointer parameter a3 in its 5th and 7th arguments, which Windows x86-64 passes on the stack. Exploration: the call summary looked at no stack-passed argument on x86-64 (eight words on x86) and made only the 16 bytes behind each pointer argument unknown, so both reads after the call folded to the values before it and the paths to -7 and to png_chunk_benign_error were pruned (the overlay had 23 CBRANCH and no call to it). Now the argument registers and the 16 words of the outgoing argument area (past the home space on Win64) are the pointers; every frame offset among them escapes, and a round that escapes a new one is followed by another. State::clobber_call leaves the call's output in all mutable image memory, in every region under a symbolic base but the entry stack pointer, and in the frame from the lowest escaped local up to the return address (and from the lowest escaped incoming argument up), the same bytes the emitter keeps alive across a call. CallOutputAt carries the base. Decompiler: with the paths back (25 CBRANCH, the call present), the benign-error test still folded. The store that passed &avail has no reader in the body and is gone before the stack alias mapping, which then marked avail `nolocalalias`, and RuleIndirectCollapse removed the call's INDIRECT on it. The exploration's escaped offsets are now kept on the Funcdata (kuna_call_escapes), and syncVarnodesWithSymbols never gives a slot from the lowest escaped local up to the return address `nolocalalias` (kuna_pushan::frame_escaped). Fixture: pushan_vm2_x86_64 gets ext7 (writes through its stack-passed 7th argument and 32 bytes past its pointer argument) and f_out; stage kuna-pushan-sound #26/#27 pin both tests (before: `ext7(); return 3;`). Stage baseline 5035 -> 5037. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mahaloz
added a commit
that referenced
this pull request
Nov 22, 2026
[AUTOMATED] Re-recorded after adding PUSHAN-SOUND #26 and #27 and merging main. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR2 of the Listing/xref tier (
docs/listing-tier-design.md§1.3, §7 PR2): invoke the keystone from the engine at bootstrap, flag-gated. PR0 builtListing::build; PR1 wired the--option listingflag withAnalysisCtx.listingalwaysNone. PR2 makes the build fire — behind the default-OFF flag — and populatesctx.listing.What's wired
kuna-analysis/src/passes.rs— threadedtranslate: &dyn Translateinto both drivers: the liverun_default_analyses_per_passand (for signature symmetry)run_default_analyses. In each, before the pass loop:Listingis owned by the driver and outlives the pass loop (same lifetime shape asfile), borrowed read-only viactx.listing(replacing thelisting: NonePR1 inserted).pub fn listing_seeds(file)=existing_function_addrs(file) ∪ collect_entries(file),in_executable_section-filtered, sorted/deduped (design §3.1), built from thepub(crate)s1_entryhelpers.pubso the cross-crateverify_listing_*gates build the exact seed set the live driver uses.kuna-console/src/engine.rs— thebootstrap_from_elfdriver call passes the engine's real decoder as the 4th arg:sleigh.base().unwrap().translate()(a&Sleigh;Sleigh: Translate; coerced to&dyn Translate). The.slais loaded and the loadimage attached at that point, so a flag-gated build decodes through it.The parity proof: flag on == flag off == today
arch.analysis_listingdefaultsfalse⇒.then(...)isNone⇒ no decode work,ctx.listing == None, byte-identical to today. With the flag on the Listing is built but no pass consumes it yet (the first consumer is PR6), so the decompiler output is unchanged. The build runs only on the real-ELF bootstrap path; the XML datatest path never reaches the analysis driver, so the 675/675 and 159/159 oracles are structurally untouched.verify_listing_parity.rs::listing_on_is_byte_identical_to_offdecompilesfauxware main → print Cwith the flag off (default) and with--option listing onand asserts the C is byte-identical (437 bytes, identical).Build-at-load timing (honest note): the analysis driver runs once inside
bootstrap_from_elf(load file), and the live CLI emitsoption listing onafterload file, so the build-at-load does not fire through the live CLI today — wiring it to fire is PR6's concern (the first consumer). The build-at-load body is exercised directly through the engine's realTranslatebelow.The build-through-engine proof
verify_listing_core.rs::listing_build_through_engine_driver_seedsbootstrapsfauxware, builds the driver's exact seed set vialisting_seeds, and runsListing::buildthrough the engine's real&dyn Translate(which reads bytes through the loader the bootstrap attached, vs PR0's throwaway loadimage). Result: 21 seeds → 21 functions, 228 instructions;function_count() > 0andinstruction_at(entry).is_some()(andinstruction_at(main).is_some()) all hold.The runtime Listing
The runtime Listing is now built behind
--option listing on(default-off). The payoff comes with the first consumer (PR6,FindNoReturnFunctionsAnalyzer); PR2 is the wiring + the parity/build proofs.Gates
make test— 675/675 PARITY OKmake test-stages— 159/159 PARITY OKmake rust-test— greenkuna catalog --check— OK🤖 Generated with Claude Code
https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb