Repository navigation
Listing/xref tier PR1: --option listing flag (default-off) - #25
Merged
Merged
Conversation
PR1 of the Listing/xref tier (docs/listing-tier-design.md, §5.1 + §7 PR1): wire the `--option listing` flag end-to-end, default-OFF, as pure plumbing. No Listing is built yet (PR2 invokes the keystone from the engine); the flag is inert. Wired, following the addrtable/formatstring precedent exactly: - architecture.rs: analysis_listing field (after analysis_formatstring), false in the constructor, reset in reset_defaults_internal, and the "listing" => on_off!(...) arm in set_kuna_option. - options.rs: "listing" added to KUNA_OPTION_NAMES. - engine.rs: "listing" => arch.analysis_listing in analysis_pass_enabled (explicit; the match fails open with _ => true). - kuna_console.rs: "listing" => on_off(conf.analysis_listing) in kuna_live_value (console-side live `current` reader). - stages.toml: a [[settable]] analysis-enablement row; stale header count comment fixed (settable=31 -> 35). - pass.rs: pub listing: Option<&Listing> added to AnalysisCtx (None for now); both AnalysisCtx construction sites in passes.rs set listing: None. Settable count: 34 -> 35. Updated all count assertions: settable_count_is_35, the live_value suppressed-set test (PASS_GATES + listing), the emit_catalog_json trailing-comma count, the catalog_bytecompat fixture + fixture_has_all_35_settables, and the kuna-base XML corpus file count (132 -> 133 with the new stage testcase). docs/assertions.md regenerated. Testcase: tests/stages/kuna-listing-flag.xml decompiles the GH-558 fixture twice (default pipeline, then `option listing on`) and asserts the C output is identical in both passes (default-off parity; the flag parses, round-trips, and is inert on the XML path). docs/baseline-stages.json regenerated (158 -> 159 passing keys; only the new KUNA-LISTING #1 key added). Gates: make test 675/675 PARITY OK; make test-stages 159/159 PARITY OK; make rust-test green; kuna catalog --check OK. Default-off + the build being real-ELF-path-only means the engine paths are byte-identical (verified: the fauxware/main decompile is identical with and without --option listing on), so the datatest oracle and the real-ELF bootstrap are untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
mahaloz
added a commit
to borancar/kuna
that referenced
this pull request
Nov 13, 2026
…ing stores to stray calls The callee walk now follows the stack addresses it loses sight of, for the extent only: one stored in a stack slot and loaded back (`push esp; pop eax`), and one a nested call returns in EAX/EDX. A load or store through a lost address leaves the extent unstated, and so does a stack address written outside the general registers (parked in xmm0) or into part of one. Slots are followed flow-sensitively for the 64 below the return address. The tracking runs only with calleeargs on and never changes a value the pop proof reads, so `calleeargs off` stays identical to the stdcall-purge walk. A trial past a call's bound is no longer dropped where a direct call in the same function whose callee states no extent, but whose window is known (its reached returns' pop or the caller's cleanup), would take the same stored value from past that window. Such a value is a local of the caller (a pushed /GS cookie, a zero-initialised buffer), and dropping it only moved it onto the other call as a stray argument. Indirect and import calls have no window and still take a freed push as their argument (the outer virtual call). TAILCALLSAVED Noelo-Lab#4 pins `sub_100074(2,1)` again, as on main. New stage cases CALLEEARGS Noelo-Lab#21-Noelo-Lab#25 (calleelost_pe_i386, clean-room asm with its recipe): the three lost-read shapes keep both arguments, the cookie-style local stays off the call with no extent, and the GetStdHandle -12 known gap is pinned as it stands. Row text, options.md and spec ch.04 describe both rules and the remaining stray-argument symptom. Stages baseline gains those keys. 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 14, 2026
…dows x86, and type its target On main calleereginputs is on by default, so the virtual-dispatch case now runs on every x86-32 image. Gate it to x86-32 Windows like the direct case (Borland and other x86-32 specs stay inert). A call the caller cleans up after (add esp,4: a C table of __cdecl function pointers reached through ECX) keeps the default, since a __thiscall callee removes its own arguments; a COM call whose interface is pushed from the register ECX was copied from keeps it too. Lay out the target type of a __thiscall-modeled indirect call under that model, so the call prints through a function pointer instead of an uncallable void *. Fixture gains ctable/comcopy (rebuilt from its recipe); stage Noelo-Lab#23-Noelo-Lab#25. 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
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.
PR1 of the Listing/xref tier (
docs/listing-tier-design.md, §5.1 + §7 PR1): wire the--option listingflag end to end, default-OFF, as pure plumbing. No Listing is built yet — PR2 invokes the keystone from the engine. The flag is inert until then.What's wired (the
addrtable/formatstringprecedent, followed exactly)infra/architecture.rs: theanalysis_listing: boolfield (in theanalysis_*block afteranalysis_formatstring),falsein the constructor, reset inreset_defaults_internal, and the"listing" => on_off!(analysis_listing, "Listing/xref disassembly tier")arm inset_kuna_option.p0_knowledge/options.rs:"listing"added toKUNA_OPTION_NAMES.kuna-console/src/engine.rs:"listing" => arch.analysis_listing,inanalysis_pass_enabled(explicit — the match fails OPEN with_ => true).kuna-console/src/kuna_console.rs:"listing" => on_off(conf.analysis_listing),inkuna_live_value(the console-side livecurrentreader, matching the analysis-pass-gate block).kuna-decomp/stages.toml: a[[settable]]analysis-enablement row (option="listing",values="on|off",default="off",change_kind="analysis-enablement", nolive_field); the stale header count comment fixed (settable=31→35).kuna-analysis/src/pass.rs:pub listing: Option<&'a Listing>added toAnalysisCtx(imported fromcrate::listing::Listing); alwaysNonefor now — bothAnalysisCtx { ... }construction sites inpasses.rssetlisting: None. PR2 will build it.docs/assertions.mdregenerated viakuna catalog --markdown(the newlistingrow appended).Catalog / count proof
settable_count_is_35, thelive_valuesuppressed-set test (PASS_GATES + thelistinggate, comment 11 → 12), theemit_catalog_jsontrailing-comma count (33 → 34), thecatalog_bytecompatfixture (stage_catalog.jsonregenerated fromdecomp_dbg) +fixture_has_all_35_settables, and the kuna-base XML corpus file-count test (132 → 133, for the new stage testcase).kuna catalog --check→ catalog OK (the catalog documents exactly the 35 registered kuna options; it cross-checks againstKUNA_OPTION_NAMESin-process).Testcase
tests/stages/kuna-listing-flag.xml(an infra test) decompiles the GH-558 fixture twice — once under the default pipeline, once withoption listing on— and asserts the source-form C (if (x <= 8)) renders identically in both passes: the flag parses, round-trips, and is inert on the XML path.docs/baseline-stages.jsonregenerated (158 → 159 passing keys; only the newKUNA-LISTING #1key added).Gates
make test→ 675/675 PARITY OKmake test-stages→ 159/159 PARITY OKmake rust-test→ green (237test result: ok, exit 0)kuna catalog --check→ OKInert until PR2
Default-OFF + the build being real-ELF-path-only means the engine paths are byte-identical:
ctx.listingis alwaysNoneand no Listing is ever built. Verified directly — decompilingfauxware'smainwith--option listing onproduces byte-identical output to the default (flag off). The datatest oracle and the real-ELF bootstrap are structurally untouched. The flag is inert until PR2 builds the Listing.🤖 Generated with Claude Code
https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb