[AUTOMATED] fix(p4): argument-recovery-options-still — extend a partial argument list when the callee's own body agrees - #455
Merged
Conversation
…al argument list when the callee's own body agrees One helper called fifteen times in one function rendered eleven times with five arguments and four times with three, from instruction-for-instruction identical machine code. `calleearity` and `calleearityfwd` both decline a call site that recovered anything at all, and that limit is measured rather than cautious: dropping it turns Sleep(200) into Sleep(200,0) and gives a variadic logger two arguments its format string has no conversions for. New option `calleearitylive` (default on, DIV-123) extends a site whose list is a strict prefix of a sibling's, using evidence the sibling does not carry: the callee's own body, read with the bounded entry decode `calleedeadarg` already takes. Every register the witness claims beyond this site's list must be read before written by the callee, and no other argument register of the model may be — which is what refuses an import (no body) and a variadic register-save prologue (reads every argument register there is). Deferred to the end of ActionActiveParam::apply, because on the witness the four short sites are the first four. Sweep: 51 binaries, 9753 functions, 42 changed (0.43%), zero regressions; the fourteen named-libc cases all match the callee's real signature. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 problem
One helper, fifteen call sites in one function, two different arities — from
machine code that is instruction-for-instruction identical at the good sites and
the bad ones.
The callee decompiles as
sub_1005250(long *,uint,uchar,uint,uchar), and bothshapes assemble the same way:
ecxandr8dare written by dedicatedmovs immediately before the call, atthe sites that keep them and at the sites that lose them alike. The three-argument
rendering is wrong output, not a shorter call.
The fix
calleearitylive(default on, DIV-123). A call site whose recoveredargument list is a strict prefix of a sibling call's is extended to that
list — the case
calleearityandcalleearityfwdboth decline, because bothrefuse a site that recovered anything at all.
not a gate flip: dropping it turns
Sleep(200)intoSleep(200,0)and gives avariadic logger two arguments its format string has no conversions for. The
evidence is the callee's own body, read with the bounded entry decode
calleedeadargalready takes, and read for two things — every register thewitness claims beyond this site's list is read before written by the callee,
and no other argument register of the model is.
variadic register-save prologue (
str x3,[sp,#136]; stp x4,x5,[sp,#144]; stp x6,x7,[sp,#160]) reads argument registers a five-argument witness does notclaim. Both measured regressions stay byte-identical.
ActionActiveParam::applyrather than reorderingfinalization: on the witness the four short sites are the first four, so an
in-order rule has no witness at any of them.
The tests
tests/stages/kuna-calleearitylive.xml— two callee/caller pairs that differ onlyin the callee: one is extended, the other is declined because the callee also reads
r8d. Both are short with the option off. Plustests/cli/argument-recovery-options-still.jsonand five unit tests on the two decisions this module owns.
Gates:
make testPARITY OK 675/675 (0 assertions changed),make test-stagesPARITY OK 644/644 (4 new, none pre-existing moved),
make rust-testgreen,make check-specgreen,kuna catalog --checkOK. Whole-corpus sweep: 51binaries, 9753 functions, 42 changed (0.43%), zero regressions — every hunk an
argument added, and the fourteen named-libc cases (
mempcpy2→3,mbrtowc3→4,__mpn_impn_mul_n4→5,__aeabi_idiv1→2, …) all match the callee's realsignature. Speed −14.79% on the witness over 7 repeats, inside the noise floor.
🤖 Generated with Claude Code