Repository navigation
[AUTOMATED] option extrapop <n> <name>: set a named function's extrapop - #1709
Merged
Merged
Conversation
Architecture::set_function_extra_pop was a stub that returned "Unknown function name" for every name. Port OptionExtraPop's per-function arm (decompiler/cpp/options.cc OptionExtraPop::apply): look the function up in the global scope and park the value on its FunctionSymbol, as the inline and noreturn options do. The decompile driver applies it to the function's own prototype, and ActionDefaultParams copies it into every call spec that targets the function, as the C++ copies the callee's prototype. 0/675 datatest assertions move. New stage test kuna-extrapop-function.xml: a `ret 8` callee whose extrapop 12 makes the caller see both pushed arguments popped.
…t is undefined `validate_pointer_targets` built the function-start fingerprint histogram, decoding two instructions of every discovered function, before checking whether any candidate pointer target is still undefined. It now filters the candidates to undefined addresses first and returns before decoding anything when none remain. The listing is not modified during the loop, so the filter is the one the loop already applied and the result is the same. User-mode instructions of `kuna functions --json`, pinned to one core: libQt6Core.so.6 30.16e9 -> 29.23e9 (-3.1%), libcrypto.so.3 24.79e9 -> 24.15e9 (-2.6%), a 314k-function AArch64 Mach-O 499.7e9 -> 472.5e9 (-5.4%). The JSON is byte-identical on all three.
A filtered run with one --addr naming an IAT slot (an import with no body) refused the whole run, so one such address in a batch decompiled nothing. Among several --addr/--functions selectors the slot is now reported as `warning: <diagnostic>; skipped` and the others still decompile. A lone slot, or a run whose every selector is one, still fails with exit 1.
[AUTOMATED] A call whose prototype is forced late (ActionDeindirect, from a typed function pointer) re-maps its existing inputs onto the locked parameters by their trials. A trial keeps the width it was recorded with, but subvariable flow can narrow the Varnode an unlocked call reads. transfer_locked_input then handed a 2-byte Varnode to build_param for an 8-byte parameter, which emitted SUBPIECE(vn:2, 0):8; RuleSubNormal folded a shift below it into a SUBPIECE with a negative offset, and get_nz_mask_local shifted by it: a build with overflow checks panicked with "attempt to shift right with overflow". transfer_locked_input now refuses an input narrower than its parameter, so the site takes the existing restart path and is rebuilt with its inputs locked. get_nz_mask_local compares the SUBPIECE offset with the word size as unsigned, as the C++ does, so it is total for an offset that is negative as an int4. Stage test kuna-narrowed-call-input, unit test nz_mask_of_a_subpiece_past_the_word.
…is re-followed Upstream ActionRestartGroup calls Architecture::clearAnalysis, which is Funcdata::clear plus commentdb->clearType(fd, warning|warningheader). refollow_flow only ran Funcdata::clear, so a warning the discarded pass raised survived into the output: a `// return-dupe` on a function whose kept pass has a single return, or a `// branch-flip` on a guard the re-run did not flip. refollow_flow now drops the function's published warning and warningheader comments and the ones still buffered on the Funcdata. tests/stages/kuna-restart-warnings.xml pins it. Datatests unchanged (675/675).
[AUTOMATED] nzmask_subpiece_negative_offset_diverges documented that get_nz_mask_local panicked in debug on a SUBPIECE truncation offset that is negative as an int4, where the C++ compares the offset with sizeof(uintb) as unsigned and returns 0. The previous commit made the port compare the same way, so the should_panic test no longer panicked. The test now asserts the C++ result, 0 for an input at or below the word and an untouched mask for extended precision.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
…ect to it option extrapop <n> <name> reached only direct calls, through ActionDefaultParams. A call through a register or an import slot takes its prototype from ArchContext::query_function, which ignored the parked value, so the same callee popped the model's bytes there. query_function now hands back the prototype with the parked extrapop; it is unchanged when no extrapop is parked. The stage test gains a caller that reaches g through ecx. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
…ing to decompile A run of an import slot plus a --functions name that matches nothing failed with "every selector names an import slot", which is false for the missing name. Count the skipped slots: the all-slots message is kept when every selector was a slot, and the mixed case says no selector names a function body. The CLI test covers the mixed case; docs/cli.md and the spec state the rule as "fails when the skips leave nothing to decompile". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Contributor
|
[AUTOMATED] Merged current main into this branch. The conflicts were the corpus count, |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
coleleavitt
added a commit
to coleleavitt/kuna
that referenced
this pull request
Nov 22, 2026
Merging upstream/main brought tests/stages/kuna-extrapop-function.xml (Noelo-Lab#1709), whose first pass prints f under the model extrapop of 4. spsolve read g's `ret 8` and applied 12 there, and it also replaced an extrapop that `option extrapop <n> <name>` stated: `option extrapop 4 g` still printed `g(1,2); return a0;`. The merge pinned `option spsolve off` in the upstream test; this drops the pin. - A call whose callee has a stated extrapop keeps it: the solve takes it as a fixed delta and settle never changes it (kuna_spsolve.rs `stated`). - spsolve applies only to a loaded ELF image (new load-time fact `Architecture::image_elf`). Under the XML <binaryimage> bootstrap the stated model is the whole contract, as for Ghidra's decompiler before any analysis records a callee's RET n. - kuna-spsolve.xml gains a third pass, `option extrapop 4 mk`, that keeps the stated value over mk's `ret 4`. [AUTOMATED] Model: anthropic/claude-opus-5-5:low
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.
[AUTOMATED]
The problem
option extrapop <n> <name>sets the stack bytes one function pops when it returns. It answers "Unknown function name" for every name, including functions that exist.greturns withret 8, so it pops 12 bytes. Without the option the model's extrapop (4) leaves both pushes on the stack andfprintsg(1); return 2;. With this change the command prints:The fix
Architecture::set_function_extra_popwas a stub. It now looks the name up in the global scope and stores the value on the function symbol, the wayoption inlineandoption noreturnstore theirs.The tests
tests/stages/kuna-extrapop-function.xml: the two functions above as bytes; pass 1 is the model extrapop, pass 2option extrapop 12 g. The pass-2 assertions fail without the change.Model:
anthropic/claude-fable-5-2