Repository navigation
[AUTOMATED] feat(ghidra): ship a ready-to-install multi-platform KunaDecompiler extension zip on releases (airgapped installs) - #316
Merged
Conversation
…ulti-platform release zips [AUTOMATED] - settings.gradle pins rootProject.name so the zip's top dir, jar, and @extname@ no longer depend on the checkout directory name. - build.gradle pins mode 0755 on the kuna_ghidra zip entries: Gradle 9 builds reproducible archives by default and normalizes every entry to 0644, which strips the exec bit Ghidra's extension installer re-applies at install time (verified against Gradle 9.7.0 and 8.5 with a real Ghidra 12.1.2 install). It also prints the resolved Ghidra install, since the GHIDRA_INSTALL_DIR env var silently outranks -P. - KunaCoreSwap self-heals a missing exec bit (setExecutable) before giving up, for zips unpacked by tools that drop unix modes. - build.sh and the READMEs point Windows/airgapped users at the prebuilt release asset; new top README section documents the release-zip install. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC
…ith prebuilt kuna_ghidra for all platforms [AUTOMATED] - The build matrix now also builds kuna-ghidra on every row and gains a native linux-arm64 row (ubuntu-24.04-arm), which upgrades the main kuna release with a linux-arm64 archive for free; each row uploads its kuna_ghidra as a ghidra-bin-* artifact. - New ghidra-ext job: downloads the pinned Ghidra 12.1.2 release (version and full asset URL pinned in workflow env; zip cached via actions/cache), stages the five binaries into os/<platform>/, builds the extension with Ghidra's own support/buildExtension.gradle (preinstalled Gradle, Java 21), asserts with zipinfo that all five os/ binaries are present and the four unix ones carry mode 0755, and publishes the zip as kuna-v<ver>-KunaDecompiler-ghidra_12.1.2.zip. - The release job now only downloads kuna-* artifacts (the ghidra-bin-* binaries are inter-job plumbing) and its notes describe the extension zip, the airgapped install story, and the Install Anyway caveat. - docs/release.md documents the new job and asset. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC
…rived Ghidra cache key [AUTOMATED] - README header no longer claims "Target Ghidra version: 12.2" (which read as excluding the 12.1.2 release zip): developed against 12.2-DEV, release zips built against the latest stable (currently 12.1.2). - KunaCoreSwap's reflection-error dialog derives the running version via Application.getApplicationVersion() instead of hard-coding 12.2, so it stays truthful inside a 12.1.2-stamped zip (compile-checked via a local gradle buildExtension against real 12.1.2 jars; zipinfo gate re-verified). - release.yml derives the Ghidra zip cache key from the pinned URL's basename (version + build date), so a re-spun same-version asset can never be shadowed by a stale cached zip. 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
Aug 17, 2026
The branch was cut from #302 while main advanced to #316; the engine PRs in between (spillargtrial #315, stackguard #306, snip-reads #307, loadguardrange #308, ...) legitimately shift the ghidra-path output, so CI's merge-ref run measured register leaks 108 vs the pinned 106. Rebase onto origin/main and re-pin every value to the rebased tree: registers 106/64/60 -> 108/58/60, unique 32/2/8 -> 34/4/8, mangled 21/13/7 -> 21/6/7, c_lines 241/174/89 -> 243/128/89, diff ratios 0.643/0.898/0.811 -> 0.646/0.867/0.811 (band unchanged); placeholders/resolvable/traffic unchanged (49/25/17, 24/18/14, 1477/1003). The sub_3320 shrink (c_lines -26%, FS_OFFSET gone from its register set, mangled 13 -> 6) is the stackguard/snip-reads work stripping the canary sequence -- explainable, not suspicious. Determinism verified: three consecutive runs of the pins test are measurement-identical. Gates on the rebased tree: harness release + --include-ignored green, make test 675/675 PARITY OK, make test-stages PARITY OK, check-spec OK, kuna-ghidra dev-profile spot check green. The full workspace suite ran green on this branch pre-rebase and every added commit is already-CI- green main history, so it is covered by the branch + main CI runs. [AUTOMATED] 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
Aug 17, 2026
…the GUI-path quality gap (#317) * feat(ghidra): ghidra-sim differential test harness — pin the GUI-path quality gap Extract the decompile_at_e2e MockJava loopback into a shared module (tests/ghidra_sim/mod.rs — AnswerSource-pluggable pump, wire builders, session tracer, dual-<function> doc parser, a markup->C flattener that replicates Java's getC() token cleaning (IllegalCharCppTransformer), badness scanners, line-diff metric) and build ghidra-sim v1 on top (tests/ghidra_sim/oracle.rs): a mock-Java answer source backed by kuna's own analysis of real vendored ELFs — bootstrap_from_object for bytes/labels, the real Sleigh re-encoded as wire <inst> docs for getPcode, and a tspec GENERATED from the loaded Sleigh's AddrSpaceManager so packed space indices agree by construction. getMappedSymbols/getExternalRef answer EMPTY at a marked PHASE-3 SEAM. tests/ghidra_sim_e2e.rs drives the full wire lifecycle (registerProgram -> setAction -> decompileAt x3 -> flushNative -> repeat -> deregister) over tests/bug-repro/faillog (sort/grep as an ignored breadth test), asserts the response-document schema (name/entry echo, markup opref/varref subset-of ast, 19-query legality + query-legal placement), and PINS today's Phase-2 reality: per-function raw-register leaks (106/64/60), Unique tokens (32/2/8), placeholders (49/25/17) of which the loader already knows names for 24/18/14 (Phase 3 drives to 0), getC()-mangled tokens (21/13/7, PR-C drives to 0), ghidra-vs-CLI line diff ratios (0.64/0.90/0.81 floors), getPcode traffic 1477/1003, and getMappedSymbols == 0 (Phase 3 flips to >=1). Pins move only with the provider/emitter change that earns them. [AUTOMATED] Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * ci(ghidra): run the ghidra-sim harness in the gates job + make test-ghidra Add a `gates`-job step running `cargo test -p kuna-ghidra --release -- --include-ignored` (with the standard specs-skip canary grep) after the catalog checks: the workspace suite is skipped on internal PRs, and a GUI-path regression is exactly what the ghidra-sim pins exist to catch pre-merge. Cost: ~1-2 min of compile over the release deps `make binaries` already built, ~2 s of test runtime. `make test-ghidra` is the same run locally. [AUTOMATED] Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * docs(ghidra): live-smoke rig + testing-strategy section for the harness integrations/ghidra/live-smoke/: a manual/dev pyghidra rig that swaps DecompileProcessFactory.exepath to kuna_ghidra inside a real Ghidra, decompiles the same functions with both cores, and writes a side-by-side report with the same badness-scanner counts the in-tree harness pins (README covers the offline-pyghidra setup and the getC()-vs-GUI-panel rendering distinction). docs/ghidra-integration.md §11 rewritten around the shipped harness: what it covers, how to run it, where the pins live. [AUTOMATED] Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * test(ghidra): harden the ghidra-sim pins per adversarial review - Diff-ratio pins are now a BAND: ceilings [0.70,0.95,0.90] join the floors (a markup regression that makes the GUI text worse now fails instead of saturating), the vacuous `<= 1.0` assert is gone, and the flattened-C normalized line count is pinned per target (241/174/89) -- the assert that actually catches a <break>-token collapse. The pin comment now decomposes the ratio (Phase-3 symbol gap + option-preset skew until setOptions is wired) so nobody chases 0 with symbol work. - decompile_cli now routes through the SHARED per-function step (kuna_console::decompile_step::decompile_one, DIV-66) with the error-noreturn CALL_RETURN flow overrides built exactly as kuna_console::project does -- the previous direct drive call silently dropped them (latent: faillog has no error() sites, and every faillog pin re-measured IDENTICAL; sort/grep-class fixtures would have diverged from the real CLI). - Assert strength: warnings frames pinned trim-empty on registerProgram and decompileAt (no substring blocklists); markup oprefs AND varrefs pinned non-empty per class; ast varnode refs collected from the <varnodes> child only (all Java's buildVarnodeRefs keys -- an op operand ref undeclared there must not launder the subset assert); the name echo compares against the sim's code_label (which consults label_overrides) rather than the raw program lookup. - CI: the gates-job harness step tees its output to a log before the canary grep, so a FAILING pin still prints its diagnostics (the old command substitution aborted under bash -e before any echo). - live-smoke docs/script: kuna_ghidra is not built by `make binaries`; point at `cargo build --release -p kuna-ghidra`. Tests/CI/docs-only diff: the parity gates are untouched by construction. `cargo test -p kuna-ghidra --release -- --include-ignored` fully green; `make check-spec` green. No pinned value moved. [AUTOMATED] Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * test(ghidra): re-measure the faillog pins on main @ 813ee13 (rebase) The branch was cut from #302 while main advanced to #316; the engine PRs in between (spillargtrial #315, stackguard #306, snip-reads #307, loadguardrange #308, ...) legitimately shift the ghidra-path output, so CI's merge-ref run measured register leaks 108 vs the pinned 106. Rebase onto origin/main and re-pin every value to the rebased tree: registers 106/64/60 -> 108/58/60, unique 32/2/8 -> 34/4/8, mangled 21/13/7 -> 21/6/7, c_lines 241/174/89 -> 243/128/89, diff ratios 0.643/0.898/0.811 -> 0.646/0.867/0.811 (band unchanged); placeholders/resolvable/traffic unchanged (49/25/17, 24/18/14, 1477/1003). The sub_3320 shrink (c_lines -26%, FS_OFFSET gone from its register set, mangled 13 -> 6) is the stackguard/snip-reads work stripping the canary sequence -- explainable, not suspicious. Determinism verified: three consecutive runs of the pins test are measurement-identical. Gates on the rebased tree: harness release + --include-ignored green, make test 675/675 PARITY OK, make test-stages PARITY OK, check-spec OK, kuna-ghidra dev-profile spot check green. The full workspace suite ran green on this branch pre-rebase and every added commit is already-CI- green main history, so it is covered by the branch + main CI runs. [AUTOMATED] Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC --------- Co-authored-by: Claude Fable 5 <[email protected]>
mahaloz
added a commit
that referenced
this pull request
Aug 17, 2026
[AUTOMATED] Rebasing onto origin/main picked up ~14 engine-changing commits (#303-#316 + #310 provenance); re-measured, only base drift moved: c_lines 274/41/91 -> 282/38/91, mangled 57/12/24 -> 57/10/24, ratios 0.175/0.220/0.264 -> 0.170/0.184/0.264 (inside the pinned band). Every Phase-3 zero (registers/Unique/resolvable) and every traffic pin (getPcode 1314, decoded 801, getMappedSymbols 1448) is unchanged. The harness module docs updated from the Phase-2 framing to the shipped Phase-3 state. 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
Aug 18, 2026
…in flips [AUTOMATED] The kuna-ghidra half of Phase 3: - provider.rs: GhidraRemoteFetch — RemoteProviderFetch + RemoteTypeFetch over the SharedClient (getMappedSymbols / getNamespacePath / getComments / getDataType as re-entrant nested queries). - translate.rs: GhidraRegisterLookup — the query-backed register resolver installed on the ghidra-mode AddrSpaceManager (the mirror of Sleigh::install_register_lookup). Without it the naming pass's is-register test (manage().register_lookup()) fails open and every register-storage high misclassifies as global data, rendering raw EAX/RBX tokens — the single largest GUI-quality defect. GhidraTranslate delegates its RegisterLookup to the shared adapter; the adapter's Weak manager back-pointer wires lazily so init-time manager_mut stays sound. - process.rs: registerProgram decodes the wire <coretypes>, applies the aggressive ENGINE-TIER preset + FUN_/DAT_/LAB_ fallback naming (DIV-77), and installs the providers; decompileAt resolves the current function's identity (name + locked prototype pieces) through getMappedSymbols with getCodeLabel demoted to fallback, and fills the per-function comment cache; setOptions decodes and applies for real via decode_lenient (DIV-76); flushNative clears the provider caches in the upstream order. - ghidra-sim: the oracle answers getMappedSymbols/getExternalRef with real <doc><mapsym>/<hole> documents built from its committed program facts (functions + locked libproto prototypes + noreturn, data symbols, section mutability), getDataType from its own factory, and sends the default-mirroring full <coretypes>; a new flushNative cache-clearing test proves a changed host answer lands after a flush. Faillog pins re-measured (the Phase-2 GUI gap -> Phase 3), same base: register leaks 106 / 64 / 60 -> 0 / 0 / 0 Unique tokens 32 / 2 / 8 -> 0 / 0 / 0 resolvable ph. 24 / 18 / 14 -> 0 / 0 / 0 placeholders 49 / 25 / 17 -> 27 / 4 / 3 (only oracle-unnamed left) diff-vs-CLI .643/.898/.811 -> .175/.220/.264 (style-normalized) getPcode total 1477 -> 1314, decoded insts 1003 -> 801 (noreturn truncation stops the flow overrun), getMappedSymbols 0 -> 1448. Mangled tokens 21/13/7 -> 57/12/24 (ctypes preset spells more multi-word types; PR-C's declarator-token split drives these to 0). [AUTOMATED] Rebasing onto origin/main picked up ~14 engine-changing commits (#303-#316 + #310 provenance); re-measured, only base drift moved: c_lines 274/41/91 -> 282/38/91, mangled 57/12/24 -> 57/10/24, ratios 0.175/0.220/0.264 -> 0.170/0.184/0.264 (inside the pinned band). Every Phase-3 zero (registers/Unique/resolvable) and every traffic pin (getPcode 1314, decoded 801, getMappedSymbols 1448) is unchanged. The harness module docs updated from the Phase-2 framing to the shipped Phase-3 state. 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
Aug 18, 2026
…ent providers (real names in the GUI) (#318) * feat(p0/infra): Phase-3 lazy wire-backed provider seams in the engine [AUTOMATED] The kuna-decomp half of ghidra-mode Phase 3 (the ScopeGhidra / TypeFactoryGhidra / CommentDatabaseGhidra port, relocated to the seams the kuna pipeline actually reads): - infra/remote_provider.rs (new): RemoteScope — getMappedSymbols query-through at the GlobalQuery boundary with <hole> negative caching, decoded-entry positive caching, readonly/volatile property paints over a lockDefaultProperties snapshot, getNamespacePath scope paths, wire symbol-id capture; the <doc>/<mapsym>/symbol-family decoder (<symbol>/<function>+<prototype>+<localdb> cat-0 params/<functionshell>/ <labelsym>/<externrefsymbol>/<equatesymbol>/<facetsymbol>); the RemoteProviderFetch wire seam trait; fill_comments (getComments, printer-filtered, fill-once-per-flush). Upstream-numbered wire ids (69-81, 161, 169, 172, 228 + attribute set). - substrate/context.rs: ArchContext.remote_scope + effective_global_query — every global read (properties, names, types, containers, query_callee_proto, query_function) queries through the provider when installed; callee_proto_pieces returns owned (single call site adapted). - infra/decompile_drive.rs: ArchFlowEnv query_call / query_call_no_return remote arms (callee names + noreturn flow truncation from mapsym facts). - substrate/dtype.rs: the wire type decode (decode_core_types / decode_type / decode_type_no_ref with incomplete-stub recursion protection for composites), the RemoteTypeFetch getDataType miss-hook in find_by_id_or_remote, clear_noncore (the flushNative eviction). - infra/architecture.rs: install_remote_provider / flush_remote_caches / printer_comment_filter / set_coretypes_xml (buildCoreTypes decodes the wire <coretypes> when present, so kuna's core-type ids match the host); decode_ghidra_tracked_sets — the pspec <tracked_set> (x86-64 DF=0) decodes into the trackbase in ghidra mode too, resolving registers through the query-backed translator, so ActionConstbase plants the string-op direction seed. - p0_knowledge/options.rs: OptionDatabase::decode_lenient — the DIV-76 setOptions divergence (apply known options, skip unknown elements whole with a "Warning:" line instead of failing the list). - p0_knowledge/database.rs + fspec/printc/flow/outline: the KunaNameStyle enum (Func|Angr|Ghidra) threaded through the address-derived fallback naming sites (FUN_/DAT_/LAB_ under ghidra mode, DIV-77); behavior- neutral on the standalone path (name_style_ghidra never set). Unit tests: the mapsym/hole/namespace decoders over hand-built packed docs, a VENDORED real Ghidra 12.1.2 DecompileDebug capture of fmt main's getMappedSymbols answer, the coretypes XML-mirror equivalence, and the lenient optionslist decode. Standalone parity: make test 675/675 PARITY OK, make test-stages PARITY OK (no provider installed => every seam takes its frozen-snapshot branch byte-identically). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * feat(ghidra): activate the Phase-3 providers + sim mapsym answers + pin flips [AUTOMATED] The kuna-ghidra half of Phase 3: - provider.rs: GhidraRemoteFetch — RemoteProviderFetch + RemoteTypeFetch over the SharedClient (getMappedSymbols / getNamespacePath / getComments / getDataType as re-entrant nested queries). - translate.rs: GhidraRegisterLookup — the query-backed register resolver installed on the ghidra-mode AddrSpaceManager (the mirror of Sleigh::install_register_lookup). Without it the naming pass's is-register test (manage().register_lookup()) fails open and every register-storage high misclassifies as global data, rendering raw EAX/RBX tokens — the single largest GUI-quality defect. GhidraTranslate delegates its RegisterLookup to the shared adapter; the adapter's Weak manager back-pointer wires lazily so init-time manager_mut stays sound. - process.rs: registerProgram decodes the wire <coretypes>, applies the aggressive ENGINE-TIER preset + FUN_/DAT_/LAB_ fallback naming (DIV-77), and installs the providers; decompileAt resolves the current function's identity (name + locked prototype pieces) through getMappedSymbols with getCodeLabel demoted to fallback, and fills the per-function comment cache; setOptions decodes and applies for real via decode_lenient (DIV-76); flushNative clears the provider caches in the upstream order. - ghidra-sim: the oracle answers getMappedSymbols/getExternalRef with real <doc><mapsym>/<hole> documents built from its committed program facts (functions + locked libproto prototypes + noreturn, data symbols, section mutability), getDataType from its own factory, and sends the default-mirroring full <coretypes>; a new flushNative cache-clearing test proves a changed host answer lands after a flush. Faillog pins re-measured (the Phase-2 GUI gap -> Phase 3), same base: register leaks 106 / 64 / 60 -> 0 / 0 / 0 Unique tokens 32 / 2 / 8 -> 0 / 0 / 0 resolvable ph. 24 / 18 / 14 -> 0 / 0 / 0 placeholders 49 / 25 / 17 -> 27 / 4 / 3 (only oracle-unnamed left) diff-vs-CLI .643/.898/.811 -> .175/.220/.264 (style-normalized) getPcode total 1477 -> 1314, decoded insts 1003 -> 801 (noreturn truncation stops the flow overrun), getMappedSymbols 0 -> 1448. Mangled tokens 21/13/7 -> 57/12/24 (ctypes preset spells more multi-word types; PR-C's declarator-token split drives these to 0). [AUTOMATED] Rebasing onto origin/main picked up ~14 engine-changing commits (#303-#316 + #310 provenance); re-measured, only base drift moved: c_lines 274/41/91 -> 282/38/91, mangled 57/12/24 -> 57/10/24, ratios 0.175/0.220/0.264 -> 0.170/0.184/0.264 (inside the pinned band). Every Phase-3 zero (registers/Unique/resolvable) and every traffic pin (getPcode 1314, decoded 801, getMappedSymbols 1448) is unchanged. The harness module docs updated from the Phase-2 framing to the shipped Phase-3 state. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * docs(ghidra): Phase-3 spec prose, integration-doc state, DIV-76/DIV-77 [AUTOMATED] The spec-live half of Phase 3: the lazy-provider walk in docs/spec/00-overview.md (RemoteScope seams, type/comment/tracked-set decode, flushNative order, setOptions leniency, the ghidra naming style), the third-style naming note in docs/spec/09-emission.md, docs/ghidra-integration.md sections 5/9/12 flipped to the shipped state, and the two DIV rows in docs/history.md: DIV-76 (setOptions skip-unknown per element) and DIV-77 (ghidra-mode aggressive engine-tier preset + FUN_/DAT_/LAB_ fallback naming). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * fix(test): verify_relocrebase missed the decompile_targets provenance arg [AUTOMATED] Base breakage ridden in with #310 (decompile-all source provenance): `decompile_targets` gained `want_provenance` and every production caller was updated, but this kuna-console integration test was not — and internal-PR CI skips the workspace suite (#274), so main's `make rust-test` is red. One-line call-site fix, no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * fix(ghidra): review round — name/label split, setOptions reset, callee model, externref resolution, wired tracked registers + the Kuna banner [AUTOMATED] The adversarial review of PR #318 confirmed six defects; all fixed, plus the user-requested version banner: 1. name/label conflation (HIGH): a <function name= label=> answer collapsed into one field preferring the LABEL, so fd.encode echoed the label and Java's HighFunction.decode would throw "Function name mismatch" whenever the default-on TemplateSimplifier sent one. RemoteFunctionFacts now carries BOTH (raw `name` = the Funcdata identity/echo, `display_name` = what prints); decompileAt passes the raw name to decompile_func_full and sets the display form via the new Funcdata::set_display_name — the upstream name/displayName split. 2. setOptions reset-then-apply (HIGH): upstream calls resetDefaults() before decoding (ghidra_process.cc:435-445) because Java DELTA-encodes options — a previously-sent non-default value must revert when set back to default. New Architecture::reset_wire_defaults (engine defaults + printer PrintContext reset) + the DIV-77 preset layer re-applied (apply_ghidra_mode_defaults) at the top of every SetOptions. 3. locked callee model dropped (MED): <prototype model=…> decoded but flattened away. The parked TypeCode now builds under the host-declared model (TypeFactoryImpl::get_type_code_proto_model) and ActionDefaultParams seeds seed_locked_from_pieces with it (ArchContext::callee_proto_model; standalone returns None, byte- identical) — a __fastcall-style callee gets the right storage. 4. external refs never resolved (MED): the <externrefsymbol> resolve <addr> was discarded and getExternalRef never fired. The decode keeps the refaddr, the pointer symbol types as pointer-to-code, and ensure_queried runs the upstream two-step (resolveExternalRefFunction, database_ghidra.cc:327-353): getExternalRef at the POINTER address, the answered function materialized at its own entry. 5. tracked registers pspec-static only (MED): ContextGhidra is wired for real — decompileAt issues getTrackedRegisters at the entry (RemoteScope::tracked_at, cached until flushNative) and merges the host's values OVER the pspec defaults before the decompile, so per-address host context (MIPS gp, PPC TOC, user 'Set Register Value') reaches ActionConstbase. The sim serves its real context db + a tracked_overrides hook; a new e2e proves a host-side tracked RSI value changes the output. 6. LOW trio: a wire/JavaError inside a lazy query now negative-caches the address for the flush epoch and surfaces ONE "Warning:" 16/17 line (RemoteScope::cache_failure/drain_warnings) instead of re-querying unboundedly; a <type> with no size attribute errors instead of interning a 0-sized datatype (WireTypeAttribs Default size -1); the readonly/volatile paint of a symbol ending at the top of its space uses the open-range end instead of wrapping to 0 and painting nothing. NEW (user request): ghidra-mode stamps a `Kuna v<version>` plate comment at the top of EVERY decompiled function (visible in the GUI that kuna is the active core). Cache-only HEADER comment (never written back, never on the 16/17 frame); version baked like the kuna CLI (KUNA_VERSION from the release matrix, workspace version on dev). The printer's emit_comment_func_header grows the upstream plate arm (renders HEADER comments — also the host's getComments PLATE fills; the standalone pipeline never inserts HEADER comments, so it is inert there). Verified LIVE in Ghidra 12.1.2: `/* Kuna v0.1.0 */` opens fmt/main. Harness: banner presence asserted per function; the CLI differential strips the banner line; c_lines pins +1 (283/39/92); new unit tests for the externref two-step + name/label split, tracked caching, and failure negative-caching over a canned wire fetcher. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC * fix(ghidra): delta-review round — tracked-register revert over a pristine base, full printer reset coverage, failure-channel separation [AUTOMATED] The five residual findings from the delta review of b9262c7: F1 (MED): the decompileAt tracked merge wrote wire-over-CURRENT into the persistent trackbase, so a value the host stopped reporting (user clears 'Set Register Value') survived every flush until deregisterProgram. The merge now applies wire-over-PRISTINE: RemoteScope::pristine_tracked_for captures the pre-merge set the FIRST time an address is merged (stored OUTSIDE the flush-cleared state — it is session-stable pspec truth) and every epoch merges the wire answer over that base; the write also fires for an EMPTY wire answer once an address was ever merged (the revert case). New e2e ghidra_sim_tracked_override_reverts_after_flush: override -> decompile -> flush -> remove override -> decompile reverts to the never-overridden baseline byte-for-byte (the flush-epoch session helper generalized to pre + at-arm oracle mutators; the label-override test now rides the same helper). F2 (LOW): reset_wire_defaults also resets the PrintC-proper state the wire options mutate — PrintC::reset_wire_option_defaults restores the PrintCOptions block (nullprinting, inplaceops, conventionprinting, nocastprinting, hideimpliedexts, the four brace formats + the kuna rendering toggles, whose construction defaults ARE the shipped defaults) and the emitter indent increment (Java default 2). The doc comment now states the exact coverage: engine defaults + PrintContext + PrintC options + indent are covered; the action-database default-group reset stays the shared STUB(W5), and maxlinewidth/commentstyle are recorded no-op printer stubs with no state to reset. F3 (LOW): tracked/externref failures no longer hole the getMappedSymbols negative cache — note_failure warns without holing (their own caches already bound re-asks: tracked_at caches even empty answers per address, resolve_external_ref fires once per decoded answer); only a failing SYMBOL query holes (cache_failure). F4 (nit): the decompileAt tracked upper bound uses the Range::get_last_addr_open open-end pattern instead of offset.wrapping_add(1), so an entry at the very top of its space cannot wrap the bound to 0. F5 (nit): the callee_models field doc now states that defaultfp fallbacks are recorded too (the consumer's unwrap_or(defaultfp) is equivalent either way). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC --------- Co-authored-by: Claude Fable 5 <[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.
The user-facing story
Installing the KunaDecompiler Ghidra extension today requires running
build.sh, which runs cargo (crates.io) at install time — the airgapped users who asked for this cannot install it at all, and there is no Windows path whatsoever. After this PR, the nightly GitHub Release carries a ready-to-install, fully self-contained extension zip:with prebuilt
kuna_ghidrabackends for all five platforms already inside —os/linux_x86_64/,os/linux_arm_64/,os/mac_x86_64/,os/mac_arm_64/(kuna_ghidra) andos/win_x86_64/kuna_ghidra.exe. Ghidra picks the right one at runtime (Windows-on-ARM falls back to the x86_64 binary via Ghidra's own emulation fallback).kuna_ghidraneeds no.slafiles — all specs arrive over the wire — so an airgapped machine needs exactly two files: the Ghidra release zip and this zip. Install = File → Install Extensions… →+→ pick the zip → restart. The zip is version-locked to Ghidra 12.1.2 (the installer's version gate keys off the stampedextension.properties); other 12.x installs go through the Install Anyway dialog (seam is stable across 12.x, but those pairings are unverified — the release notes and README say so).CI design (release.yml)
buildmatrix now also builds-p kuna-ghidraon every row, and gains a native linux-arm64 row (aarch64-unknown-linux-gnuonubuntu-24.04-arm, smoke-tested) — which upgrades the main kuna release with akuna-v<ver>-linux-arm64.tar.gzarchive for free. Each row uploads itskuna_ghidraas aghidra-bin-<platform>artifact (deliberately notkuna-*: thereleasejob now downloadspattern: kuna-*so the raw binaries never become release assets).ghidra-extjob (ubuntu-latest): downloads the five binaries; downloads the pinned Ghidra release — bothGHIDRA_VERSION: 12.1.2and the full asset URL are pinned in workflowenv(the asset filename embeds a build date not derivable from the version), zip cached with first-partyactions/cacheunder a key derived from the URL's basename so a URL bump always invalidates it; stages the binaries intoos/<platform>/; builds with Ghidra's ownsupport/buildExtension.gradle(preinstalled Gradle,JAVA_HOME_21_X64); then a zipinfo gate asserts all fiveos/binaries are present, the four unix ones carry mode 0755, the zip has a singleKunaDecompiler/top dir, andextension.propertieswas stampedversion=12.1.2— any miss fails the job. The verified zip is renamed to state both versions and flows into the existing release-asset path. No new third-party actions.Two real bugs the local verification caught
build.gradle: aneachFilerule pinsrwxr-xr-xon thekuna_ghidraentries (API exists since Gradle 8.3; verified on 9.7.0 and 8.5). The zipinfo gate exists so this class of failure can never ship silently again.GHIDRA_INSTALL_DIRenv outranks-PGHIDRA_INSTALL_DIR. The skeleton-standard build.gradle prefers the env var, so a profile-exported install dir silently overrides the flag (locally this produced a zip stamped for the wrong Ghidra). CI now passes the env var explicitly, andbuild.gradleprints the resolved install dir so a mis-pointed build is visible.Other changes
settings.gradlepinsrootProject.name = 'KunaDecompiler'(zip top dir / jar /@extname@no longer depend on the checkout dir name).KunaCoreSwap.checkExecutableself-heals a missing exec bit (setExecutable(true, false)) before throwing — covers zips unpacked by tools that drop unix modes.build.shkeeps its behavior; the unsupported-host (Windows) error and the header now point at the release asset as the supported path.KunaDecompiler/README.mdgains a top "Install from a GitHub Release (recommended; works airgapped)" section;docs/release.mddocuments the new job and asset.Local verification (real gradle build, no CI guessing)
Built with Gradle 9.7.0 (the exact ubuntu-latest preinstalled version; also cross-checked with Gradle 8.5, Ghidra's minimum) against the real Ghidra 12.1.2 install, with the real linux_x86_64
kuna_ghidrastaged plus correctly-named dummies for the other four platforms. The build also compile-checks theKunaCoreSwap.javachange against real 12.1.2 jars. Output:(Listing elided to the load-bearing entries; the full zip has 22 entries, also carrying
Module.manifest(required marker),README.md,build.sh,ghidra_scripts/KunaCoreStatus.java,os/linux_x86_64/README.md, andlib/KunaDecompiler-src.zip— all harmless.)Single
KunaDecompiler/top dir,extension.propertiesat depth 2 with@extversion@→12.1.2,lib/KunaDecompiler.jarpresent, all fiveos/entries, unix modes 0755 — the exact layoutExtensionUtilsrequires. The workflow's verification step was run verbatim against this zip: all assertions pass. Staged binaries cleaned up afterwards (they are gitignored).Gates
This diff touches no Rust, test, or spec-anchored files (
git diff --stat: release.yml, docs/release.md, andintegrations/ghidra/KunaDecompiler/**only), so the parity gates cannot be affected; they run on this PR as usual.make check-specpasses locally. The workspace suite is skipped on internal PRs, so thefull-cilabel is added to this PR to force it in CI anyway.🤖 Generated with Claude Code
https://claude.ai/code/session_01AfGYKwUWvPYYj1Aw7tcLhC