Repository navigation
Conversation
THE PAYOFF for the FID port: wire the FID mechanism (PR1's
Sleigh::instruction_mask, PR2's byte-exact FNV-1a64 hasher, PR3's
.fid DB + generator) into a default-off Listing/xref consumer that
re-identifies a function in a STRIPPED binary purely by its
instruction-stream fingerprint.
Before/after on the stripped, static, -no-pie x86-64 fixture
tests/fixtures/fid/prog (kuna_crc32 @ 0x4017c0):
--option fid off (default) -> sub_4017c0
--option listing on --option fid on -> kuna_crc32
(+ kuna_fid_db=tests/fixtures/fid/lib.fid)
The binary is stripped (no symbol table), so the function is the
engine placeholder sub_4017c0 by default; FID renames it to
kuna_crc32 by a full-hash match against the vendored lib.fid. Same
body (the CRC-32 loop, 0xedb88320), only the name changes.
Wiring (each piece a clone of the noreturn_disc consumer):
- s1_fid/mod.rs FidPass (id "fid", S1): inert without the Listing
AND without a configured DB (kuna_fid_db env var). Hashes each
listing.functions() entry over the [entry,next) extent via the
same build::fingerprint_from_mask projection the generator uses;
pick_unique_name emits a name only when the full-hash bucket
collapses to one name (never guesses on a tie).
- pass.rs FidMatch + AnalysisOutput.fid_names + merge.
- engine.rs FID rename commit arm (after the no-return arm): resolve
by address, rename only behind the is_generic_placeholder_name
label gate (sub_/func_/FUN_/LAB_, never a real .symtab/DWARF name)
+ the "fid" => analysis_fid gate.
- Option surface: architecture.rs field/default/reset/set_kuna_option,
options.rs KUNA_OPTION_NAMES, stages.toml [[settable]] fid block,
settable count 60 -> 61 (tests.rs count/comma/PASS_GATES,
catalog_bytecompat.rs, kuna-catalog.xml #5/#9 max 61->62),
regenerated stage_catalog.json + docs/assertions.md.
- DB path from the kuna_fid_db env var (a --fidb flag is deferred).
Real-ELF-path-only + default-off => the XML datatest path never
builds a Listing or runs FID, so the 675/158 oracles are
structurally untouched.
Gates: make test 675/675 PARITY OK; make test-stages 222/222 PARITY
OK; make rust-test green incl. the new verify_fid e2e (2 tests, ran
not skipped); kuna catalog --check catalog OK.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
mahaloz
added a commit
that referenced
this pull request
Jun 26, 2026
…post-rebase After rebasing onto main (FID PR4 #101 brought settables to 61), the combined tree has 62 settables; the console 'stage catalog' + 'stage catalog returnpair' emits 63 use_when / change_kind entries (62 + returnpair double-count), so bump the KUNA-CATALOG #5/#9 max from 62 to 63. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01PBrckq3YYAzBLq5k4KpWac
mahaloz
added a commit
that referenced
this pull request
Jun 26, 2026
Reconcile the taildup feature with main after the FID PRs (#97-#101) and switchmultipred (#102) landed: - ElementId: taildup collided with switchsharedcase (both 4106 on the merged tree). Renumbered taildup -> 4108 (next free above ifelseflatten's 4107). - Count unions (taildup +1 settable, switchmultipred +1, fid +1 vs merge-base): settable 60 -> 63, surface stays 97 (taildup adds no surface row), corpus files 151 -> 153, universalaction leaves -> 264 (252 C++ + 5 kuna), bytecompat fixture 63, stages.toml header counts. - kuna-catalog.xml provenance: source_decompiler angr 22, structure-recovery 12 (+taildup), opt-in-tool 11 (+switchmultipred), use_when/change_kind max 64 (settables + returnpair double-count in `stage catalog`). - Regenerated docs/assertions.md (no change) and docs/baseline-stages.json (230 passing keys). Gates: catalog --check OK; make test PARITY OK 675/675 (baseline.json untouched); make test-stages PARITY OK 230/230; make rust-test green.
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 PAYOFF — the stripped-binary re-identification
PR1-PR3 built the FID mechanism (the
Sleigh::instruction_maskaccessor, the byte-exact FNV-1a64FidHasher/FidHashQuad, the kuna-native.fiddatabase +kuna fid buildgenerator). PR4 wires it into a default-off Listing/xref consumer pass that re-identifies a function in a STRIPPED binary purely by its instruction-stream fingerprint — the one capability unique to FID.Before / after (the only thing FID does)
On the stripped, statically-linked,
-no-piex86-64 fixturetests/fixtures/fid/prog(kuna_crc32pinned at VMA0x4017c0):--option fid off(default)sub_4017c0uint4 sub_4017c0(uint1 *a0,uint4 a1) { ... 0xedb88320 ... }--option listing on --option fid on+kuna_fid_db=tests/fixtures/fid/lib.fidkuna_crc32uint4 kuna_crc32(uint1 *a0,uint4 a1) { ... 0xedb88320 ... }The binary is
strip --strip-all'd (NO symbol table), so the function is the engine placeholdersub_4017c0by default — proving the name is not a leftover symbol. With FID on it is renamed tokuna_crc32, recovered by a full-hash match against the vendoredlib.fid(built bykuna fid buildover the un-strippedlib.o). Same function, same body (the CRC-32 loop with the magic0xedb88320), only the name changes. Only FID could do this.The
verify_fide2e proves the transition two ways — the symbol-table name at0x4017c0(the rename ground truth) and the rendered C — and ran (not skipped).Wiring (each piece a verified clone of the
noreturn_discconsumer)s1_fid/mod.rs—FidPass(id "fid", S1): inert without the Listing AND without a configured DB (kuna_fid_dbenv var, mirroring the loader'skuna_i386_pie_plt). Over eachlisting.functions()entry it builds the[entry,next)extent (PR2'sextent::calculate_extent), fingerprints each instruction via the SAMEbuild::fingerprint_from_maskprojection the generator uses (drivingSleigh::instruction_mask), hashes withFidHasher, queriesdb.find_by_full_hash, andpick_unique_name(emit a name ONLY when the bucket collapses to one name — never guess on a tie). Registered inlisting_consumer_passes().pass.rs—FidMatch { addr, name }+AnalysisOutput.fid_names+ themergeline.engine.rs— the new FID rename commit arm (after the no-return arm): resolve the function by ADDRESS (find_function_across_scopes), then — ONLY behind the label gateis_generic_placeholder_name(sub_/func_/FUN_/LAB_, never a real.symtab/DWARF name) —Database::rename_symbol+register_symbol. The SymFact path is an idempotent-add and would no-op on an existing function, so the rename is the one net-new piece of plumbing. +"fid" => arch.analysis_fidgate.noreturn_disc):architecture.rsfield/default/reset/set_kuna_optionarm;options.rsKUNA_OPTION_NAMES;stages.toml[[settable]] fidblock (default="off",change_kind="analysis-enablement"); settable count 60 → 61 (kuna_stages/tests.rscount + comma +PASS_GATESsuppressed set,catalog_bytecompat.rs,kuna-catalog.xmlStage reorg #5/Fix test stages #9max61→62); regeneratedstage_catalog.json+docs/assertions.md.kuna_fid_dbenv var (a real--fidb <path>flag is deferred). The strippedtests/fixtures/fid/progis vendored (recipe + the pinned VMA in the fixture README).Speed
The FID-on decompile of
kuna_crc32(load function + decompile + print C) is ~6.5 ms wall; the default (FID-off) path builds no Listing and runs no consumer. The FID hash is a single per-function decode-pass + FNV stream, on an opt-in, real-ELF-only path — no impact on the default pipeline (FID never runs by default).Parity
Real-ELF-path-only + default-off ⇒ the XML datatest path never builds a Listing and never runs the FID consumer, so the 675/158 oracles are structurally untouched.
Gates
make test— 675/675 PARITY OKmake test-stages— 222/222 PARITY OK (the KUNA-CATALOG Stage reorg #5/Fix test stages #9use_when/change_kindmaxbumped 61→62; the catalog<script>emits the full catalog + onereturnpairsingle-row, so the count is settables+1)make rust-test— green (exit 0, 0 failures) incl. the newverify_fide2e (2 tests) + the regenerated catalog tests + the SLEIGH.slacontent-paritykuna catalog --check— catalog OKSee
docs/analysis-port-log.mdIncrement 56 +docs/rust-port/losses.mdLOSS-251 (kuna ships the FID mechanism + its own.fidDB, not Ghidra's datasets;.fidbfinterop deferred; extent[entry,next)-approximated).🤖 Generated with Claude Code
https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb