Repository navigation
[AUTOMATED] Add a callproto assertion for the prototype of one call instruction - #1673
Merged
Merged
Conversation
…nstruction `--assert 'callproto [<func>::]<callsite> <C declaration>'` states the arguments and return of the call made by one instruction. A call through a pointer or a register has no callee symbol to carry a signature, and a variadic callback takes different arguments at each call, so `prototype` and `data` cannot say it. The directive goes through the per-call-site prototype override the engine already has (the console's `override prototype`), on both the script surface and the in-process one. A parameter may be followed by `@<storage>` to be read from that storage rather than the place the calling convention gives it, and a `@<storage>` after the parameter list places the return. `override prototype` takes the same declaration, and no longer needs the trailing `;`. An address at which the function makes no call is rejected with `No call is made at this address`. Fixes Noelo-Lab#1643
… one, refuse a named convention - calltargettype skipped every call with a locked prototype, so stating the prototype a call already had turned `(*(int (*)(int,int))cb)(a,b)` into the uncompilable `(*(void *)cb)(a,b)`. A prototype stated at the call itself (`override prototype` / `callproto`, not a format string's) is now typed from its arguments like an unlocked call, with the stated parameters' storage standing in for the recovered storage it does not have. - Two callproto directives for one call both reported `applied` while only the later took effect; the earlier is now rejected on both surfaces. - The override is built under the default model, so a declaration naming another calling convention is rejected by name instead of a syntax error. - The fixture recipe gains -fcf-protection=full (the committed binary has endbr64); docs example now carries the `data` assertion its output needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
Contributor
|
[AUTOMATED] Pushed two commits on top of your branch (cd355a2, e2de476):
Tests: three CLI cases in |
…ed prototype Building the type from the arguments' recovered types spelled a stated `long f(long, long)` as `unsigned long (*)(unsigned long,unsigned long)` and a string-literal parameter as `void *`. A call whose prototype was stated at the call now takes its return and parameter types from that declaration. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
A call-site prototype is laid out under the default model, and a declaration naming any other convention is rejected. The check compared names only, so on x86-64 Windows `__cdecl` and `__stdcall`, which the compiler spec declares as aliases of the default `__fastcall` (`<modelalias>`), were rejected with a message saying they are not the default. A named model is now accepted when it is the default or an alias of it with the same `this` handling (`ProtoModel::is_compatible`). The CLI test helper passed `--assert-strict` as a directive, so the strict-exit check passed on a usage error; it is now a flag, and the check pins exit code 1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
A prototype stated at an indirect call types the call's target so the call stays one C can make, but a variadic statement was still skipped, so `callproto <site> void f(char *, ...)` printed the call through `(void *)`, which no C compiler accepts, where the unstated call had been compilable. A stated variadic prototype now types the target with its fixed parameters and `...` when the call passes at least those, laid out in the storage the stated parameters were given. Calls without a stated prototype take exactly the path they took before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
Count-only conflicts: the stage corpus count in xml.rs (main 783 + this branch's kuna-callproto = 784) and docs/baseline-stages.json, synthesized from both sides (main 4524 + 4 = 4528). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
Contributor
|
[AUTOMATED] Pushed two small fixes on top (1742978, 4e28ecb) and a merge of main (6758619, count-only conflicts in
With no directive, output matches main byte for byte across 702 binaries (20,887 functions): DWARF objects for six architectures, 60 i386 PEs, and Go and Rust binaries. The one exception is a function that exceeds the time budget on every build, where only the reported action differs. |
Main gained callee (Noelo-Lab#1676) and format/isolate (Noelo-Lab#1679) beside callproto in the same assertion files: every directive list, Body variant and match arm keeps both sides, assertions.rs keeps record_rejected_callee_overrides and record_unbound_call_prototypes whole, project.rs calls both, and assertion_outcomes runs both restatement passes. 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.
[AUTOMATED]
--assertcan state a function's signature and type a function-pointer global, but not the arguments of one call through a pointer. Here the second call through a variadicloggergains a fifth argument, the call target itself, and nothing can remove it:With this change the call is given its own declaration (
0x13b0is the tail jump,0x2458theloggerslot; clang/lld 22):The change
callproto [<func>::]<callsite> <C declaration>. It uses the per-call-site prototype override the engine already has (the console'soverride prototype), onkuna decompileand on the one in-process loopdecompile-all,decompile-projectand the in-browser front-end share.@<storage>, in the spellingparamtakes, to be read from there instead of where the calling convention puts it (int a @R8D). A@<storage>after the parameter list places the return. Parameters without one are placed by the convention around those that have one.override prototypetakes the same declaration and no longer needs the trailing;.--assert-strictmakes that exit non-zero. A tail jump treated as a call counts as a call.Tests
kuna-cli/tests/call_site_prototype.rs: the repro on both decompile surfaces prints exactly four arguments, a parameter placed with@R8reads the target register, and a non-call address is rejected (and fails under--assert-strict).tests/stages/kuna-callproto.xml: nothing stated, a stated prototype, and a placed parameter, throughoverride prototype.@<storage>split.Fixes #1643