fix: 32-bit x86 arg passing + guard arch/bits mismatch in unicorn runner - #12
Merged
Merged
Conversation
run_function had no 32-bit x86 default register set, so arch='x86' fell back to 64-bit register names (rdi, rsi, ...). Written into a 32-bit unicorn instance those are no-ops, so every 32-bit call silently saw arg=0 and returned 0. Similarly arch='x86_64' + bits=32 mixed a 64-bit register naming with a 32-bit mode -> same silent no-op. - add x86 / x86_ms arg + ret register sets (32-bit cdecl / Microsoft) - map arch -> bit width; derive bits from arch when omitted - raise ValueError on an explicit arch/bits mismatch (the verifier turns that into a clean INCONCLUSIVE instead of a silent wrong 0) Adds 6 regression tests (32-bit add works, bits derived, 64-bit regression, mismatch raises, 32-bit behavioral_equiv, equiv mismatch raises). Full suite: 246 passed.
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.
fix: 32-bit x86 arg passing + guard arch/bits mismatch in unicorn runner
run_function had no 32-bit x86 default register set, so arch='x86' fell
back to 64-bit register names (rdi, rsi, ...). Written into a 32-bit
unicorn instance those are no-ops, so every 32-bit call silently saw
arg=0 and returned 0. Similarly arch='x86_64' + bits=32 mixed a 64-bit
register naming with a 32-bit mode -> same silent no-op.
that into a clean INCONCLUSIVE instead of a silent wrong 0)
Adds 6 regression tests (32-bit add works, bits derived, 64-bit
regression, mismatch raises, 32-bit behavioral_equiv, equiv mismatch
raises). Full suite: 246 passed.
Fixes a silent arg-dropping bug in the Unicorn behavioral-execution path. No change to the 64-bit default behavior (regression-tested).