Repository navigation
Analysis-tier: _INIT_<i>/_FINI_<i> array-element naming - #17
Merged
Merged
Conversation
Give the dynamic INIT/FINI entry points their Ghidra loader names instead of the generic sub_<addr>, faithful to ElfProgramBuilder.createDynamicEntryPoints: DT_INIT_ARRAY[i] -> _INIT_<i>, DT_FINI_ARRAY[i] -> _FINI_<i>, and the single DT_INIT/DT_FINI -> _DT_INIT/_DT_FINI. The Increment 15 sweep's one cosmetic follow-up. Shape: an additive `entry_names: Vec<(u64, String)>` overlay on AnalysisOutput (NOT a reshape of `entries`). s1_entry::collect_entries is byte-identical, and dynamic_entry_points is now exactly dynamic_entry_points_named().map(|(a,_)| a) -- a guaranteed-equal projection -- so WHICH VMAs are discovered provably does not change. The commit seam (engine.rs step 2) consults the overlay by address; a miss falls back to name_function (sub_<addr>) as before, and the idempotent find_function no-op keeps a real .symtab/.dynsym name winning on non-stripped binaries -- only never-symboled array-element starts take the _INIT_<i> names. Purely additive under the always-on entry_disc pass (no new option). DT_PREINIT_ARRAY (_PREINIT_<i>) wired as the faithful seam but emits nothing (kuna does not currently discover preinit-array elements; that would change the discovery set). Proof on stripped_dynamic_x86_64: .init_array[0]->0x1240 and .fini_array[0]-> 0x1200 register as _INIT_0/_FINI_0; DT_INIT@0x1000/DT_FINI@0x1464 as _DT_INIT/ _DT_FINI. `kuna decompile ... sub_1240` now errors; `... _INIT_0` decompiles. Tests: kuna-analysis +3 (names overlay, kept-filter, named-projection equality); the existing discovery tests pass unchanged. kuna-console +1 e2e (verify_s1_entry::dynamic_init_fini_elements_get_ghidra_names). make test 675/675 PARITY OK; make test-stages 158/158 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
mahaloz
added a commit
that referenced
this pull request
Sep 30, 2026
… to keeps printing as the global A load the binary makes of a global after storing a computed value to it is left on the global while the value is read sign-sensitively; otherwise the value and its stores are marked and Merge joins them with the global as before. Fixtures gain w_realias/w_rephi/w_reboth/w_recopy (store, pointer store, load); stage assertions #17-#21, and #5/#6/#9 follow the loads the -O0 binary makes. 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 1, 2026
… to keeps printing as the global A load the binary makes of a global after storing a computed value to it is left on the global while the value is read sign-sensitively; otherwise the value and its stores are marked and Merge joins them with the global as before. Fixtures gain w_realias/w_rephi/w_reboth/w_recopy (store, pointer store, load); stage assertions #17-#21, and #5/#6/#9 follow the loads the -O0 binary makes. 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
… to keeps printing as the global A load the binary makes of a global after storing a computed value to it is left on the global while the value is read sign-sensitively; otherwise the value and its stores are marked and Merge joins them with the global as before. Fixtures gain w_realias/w_rephi/w_reboth/w_recopy (store, pointer store, load); stage assertions #17-#21, and #5/#6/#9 follow the loads the -O0 binary makes. 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
… to keeps printing as the global A load the binary makes of a global after storing a computed value to it is left on the global while the value is read sign-sensitively; otherwise the value and its stores are marked and Merge joins them with the global as before. Fixtures gain w_realias/w_rephi/w_reboth/w_recopy (store, pointer store, load); stage assertions #17-#21, and #5/#6/#9 follow the loads the -O0 binary makes. 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
… to keeps printing as the global A load the binary makes of a global after storing a computed value to it is left on the global while the value is read sign-sensitively; otherwise the value and its stores are marked and Merge joins them with the global as before. Fixtures gain w_realias/w_rephi/w_reboth/w_recopy (store, pointer store, load); stage assertions #17-#21, and #5/#6/#9 follow the loads the -O0 binary makes. 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
Nov 3, 2026
…hat crosses a skipped call
A kept guard's input can be the value from before a skipped call. Merging
copies that input to the global in front of the call when the input and the
guard's output cannot share a variable (Merge::mergeIndirect's snip). With
every guard built the copy stores what the global already holds; across a
skipped call it stores the value from before that call and undoes it.
`if (a & 1) f0(); else f1(); if (h > 17) { f2(); f0(); } else { arr[a & 7] =
g + 8; fi(g); }` (gcc -O2) printed `f2(); g = v1; f0();` under persistcalls on.
- Mark kept guards whose input crosses a skipped call (kuna_persist_stale,
stale_inputs); a merge copy of such an input or its collapse restarts the
function with every guard built.
- Count a system call that guards memory as a STORE, so the call before it
keeps its guard and the system call's own INDIRECT never reads a stale value.
- Funcdata::clear clears the merge engine's state (upstream covermerge.clear()),
which a restart from merging needs.
- The pass a function runs once its re-flow budget is spent cannot restart, so
it keeps every guard.
Tests: persistcalls #15-#17 (snip, snipsys in the rebuilt semantic fixture)
fail before this change; unit test for stale_inputs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKMUBscgGJBW9XHH5hJ
mahaloz
added a commit
that referenced
this pull request
Nov 14, 2026
…ister is not a callee input The callee-first convergence sweep decompiled every function naming a superseded synthesized struct again, whatever its size. With calleereginputs on, an AutoIt-compiled image names superseded `this` records in 37 interior bodies of ~1,500 lines each, and the sweep cost a fifth of the run. The redos are now admitted shortest first within 5% of the first pass's printed lines (at least 2,000 lines; bodies of 32 lines or fewer always); a declined body keeps its superseded, still-defined struct. Every other binary measured stays under the budget, so its output is unchanged. calleereginputs' callee walk counted a register as read when a read touched any byte not yet written, so `mov cx,[eax+0xa]; mov esi,ecx` (the CRT float formatter) made the callee __thiscall and its callers passed an ECX a previous call had clobbered. A register now counts only when read before any part of it is written. Stage test #17 pins it with a new clean-room case. 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
… by-value block The calleeargs window is what the callee's returns pop or what the caller removes after the call. For a __cdecl callee that is the caller's cleanup, or an `add esp` releasing the caller's own locals before its epilogue, and stating it as the call's pop moved every stack slot after the call: the caller lost a parameter or read one in place of a local. It also let a bottom-of-frame local, or a block built for a later call (`f(g(0), t)` copies t, then calls g), expand into the next call's arguments. Flow now records what the callee's reached returns pop (`ret 0x20`) on the call spec, and repframecopy relies on that alone. byvalreuse_pe_i386 gains cleanup, local and nested; REPFRAMECOPY Noelo-Lab#15-Noelo-Lab#17 fail without this. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
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.
Give the dynamic INIT/FINI entry points their Ghidra loader names instead of the generic
sub_<addr>, faithful toElfProgramBuilder.createDynamicEntryPoints. This is the one cosmetic follow-up the Increment 15 completeness sweep flagged.What
Per
ElfProgramBuilder.createDynamicEntryPoints:DT_INIT_ARRAYelementi→_INIT_<i>DT_FINI_ARRAYelementi→_FINI_<i>(Ghidra'sbaseName + i)DT_INIT/DT_FINI→_DT_INIT/_DT_FINI(Ghidra's"_" + dynamicEntryType.name)DT_PREINIT_ARRAY(_PREINIT_<i>) is wired as the faithful seam but emits nothing — kuna does not currently discover preinit-array elements as code entries, and adding that would change the discovery set.Shape choice — additive overlay (not a reshape)
AnalysisOutput.entriesstaysVec<u64>; a new parallelentry_names: Vec<(u64, String)>overlay carries the names. Chosen over reshapingentriestoVec<EntryFact>because it makes the discovery byte-identical property provable:s1_entry::collect_entriesis untouched.dynamic_entry_pointsis now exactlydynamic_entry_points_named(file).map(|(a,_)| a)— a guaranteed-equal projection (unit-tested:dynamic_entry_points_is_named_projection), and the pushed VMAs/order are identical to before.sub_<addr>behavior.The commit seam (
engine.rs::commit_analysis_outputstep 2) consults the overlay by address; a miss falls back toname_function(sub_<addr>) as before. The idempotentfind_functionno-op is kept, so a non-stripped binary's real.symtab/.dynsymname still wins — only genuinely new, never-symboled array-element starts take the_INIT_<i>names.Flag. Purely additive on the always-on
entry_discpass — no new option, no settable-count bump.--option entry_disc offdisables the whole discovery pass (names and all) as before.Before / after
On the vendored stripped PIE
stripped_dynamic_x86_64(.symtabstripped;.init_array@0x3d78→0x1240,.fini_array@0x3d80→0x1200,DT_INIT@0x1000,DT_FINI@0x1464):BEFORE — array elements named generically:
AFTER — Ghidra-faithful names:
Tests
kuna-analysis+3 unit tests (dynamic_entry_names_stripped,collect_entry_names_matches_collected_entries,dynamic_entry_points_is_named_projection). The existingdynamic_entry_points_stripped/collect_entries_*discovery tests pass unchanged (byte-identical discovery).kuna-console+1 e2e (verify_s1_entry::dynamic_init_fini_elements_get_ghidra_names):_INIT_0/_FINI_0/_DT_INIT/_DT_FINIresolve,_INIT_0decompiles,sub_1240no longer resolves.Gates
make test→ 675/675 PARITY OKmake test-stages→ 158/158 PARITY OKmake rust-test→ green (0 failed)kuna catalog --check→ catalog OK (no new option)🤖 Generated with Claude Code
https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb