[AUTOMATED] fix(cli): xrefs --to <import name> answers instead of refusing it as ambiguous - #441
Merged
Merged
Conversation
…ame> answers instead of refusing An import's name is on two addresses — a forwarding veneer and the IAT/GOT slot it jumps through — so `kuna xrefs --to VirtualProtect` was refused as ambiguous while `--to 0x1400079b0` and `--to 0x14000d234` both answered it, identically, over that alias class. The check could not have consulted the class where it stood: `alias_class` is the connected component of the DECODED `jmp [slot]` relation, and the walk that decodes it runs after target resolution because it needs the target address to focus on. So a contested name is no longer decided at lookup time. Its candidates ride into the walk as its focus set and are settled afterwards: candidates that all lie in one class are one callable and resolve to the class's code half — the veneer — while candidates that do not are distinct functions and keep the refusal with every candidate named. The fold therefore rests on the decoded jump and never on the shared name. A read-only query surface commits nothing into the engine and emits no C, so there is no option, no stages case and no catalog counter. Sweep over every duplicate-name entry in every binary fixture — 148 names in 14 images — folded 129 and refused 18, with every fold answering byte-identically to each of its own candidate addresses and every refusal naming all of them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mahaloz
force-pushed
the
feat/re-name-based-xrefs-rejects
branch
from
September 6, 2026 03:41
6b1b57f to
7ee207c
Compare
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
kuna xrefs --to <name>refuses to answer for an import, because an import'sname is on two addresses and the selector model calls that ambiguous — while
either of the two addresses answers the question fine.
The two candidates are one callable: a
.textFF 25veneer and the.rdataIAT slot it jumps through.
--tohas answered over that alias class sincexrefs-unify-pe-import, so both addresses already return the same rows — thename was the only spelling that could not reach them.
The fix
callable is a property of the decoded forwarding jumps, and those only exist
once the walk has run, so the candidates are carried into the walk as its focus
set and the ambiguity is settled afterwards against the alias class.
the class's code half — the veneer, which is the address the answer is next
disassembled at — with the lowest address breaking a tie between several
veneers through one slot.
refusal, with every candidate still named. The fold rests on the decoded jump,
never on the shared name, so two static
duplicate_locals are never merged.cannot change emitted C.
The tests
Three cases in
kuna-cli/tests/xrefs_cli.rs: the import resolved by name answersbyte-for-byte what its veneer address answers;
puts, reached through the veneerrather than the slot, folds the same way; and
duplicate_localin a relocatableobject is still refused with both candidates. The first two fail without the fix
(exit 1, "is ambiguous"). The acceptance probe is promoted to
tests/cli/name-based-xrefs-rejects.json.A sweep over every duplicate-name entry in every binary fixture — 148 names in 14
images — folded 129 and refused 18, with every fold answering identically to each
of its own candidate addresses and every refusal naming all of them.
🤖 Generated with Claude Code