Skip to content

[AUTOMATED] Add kuna-verify localize: name the rule application after which a function differs - #2109

Open
sjkim1127 wants to merge 3 commits into
Noelo-Lab:mainfrom
sjkim1127:diffverify-localize
Open

sjkim1127 wants to merge 3 commits into
Noelo-Lab:mainfrom
sjkim1127:diffverify-localize

Conversation

@sjkim1127

@sjkim1127 sjkim1127 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

The third piece of #1830's split, on top of #2108 (whose commits it carries; review from adc86b9e8). When kuna-verify says a function DIFFERS, localize names the rule applications after which it starts to differ.

make binaries specs
(cd decompiler && cargo build --release -p kuna-verify)
decompiler/target/release/kuna-verify localize tests/stages/kuna-narrowext.xml csc
csc (decompile 1)  differs; of the 12 rules that applied, it agrees without these, in the order their last needed application ran (candidates found by bisection):
  step    17  collapseconstants  application 3 of 3 at 0x10032 (agrees with 2, differs with 3)
  step    19  propagatecopy  application 8 of 11 at 0x10036 (agrees with 7, differs with 8)  <- latest
    input    k=0x00000040 (a0)
    machine  a0 = 0xffffffffffffff94
    kuna     int8 csc(int4 k) = 0x0000000000000294

With narrowext off, the propagatecopy at 0x10036 carries the unextended byte on.

  • Each rule that applied is held back alone through the rule cap from [AUTOMATED] Add the engine hooks a differential checker needs #2107, and the number of its applications allowed is bisected: with k - 1 the function agrees over every run, with k it differs. Every other rule runs as usual.
  • Bisection assumes a later application does not undo an earlier one, so k is a candidate to look at, not a proof that it is the only cause. The output says so.
  • It checks under the same --contract and --options as check; --pass N picks one decompile of a datatest script.

Tests: localize_names_the_copy_rule pins the result above; localize_uses_the_contract checks that a difference only the contract shows is localized only with the contract. Run over the corpus's 113 DIFFERS, it names 15 down to a rule application; the rest come from actions (docs/features/diffverify/c3-results.md).

🤖 Generated with Claude Code

Model: anthropic/claude-opus-5-5

sjkim1127 and others added 3 commits December 5, 2026 09:48
A rule cap that counts rule applications per thread and can stop one rule
after its first n, checked once per rule attempt in ActionPool::process_op
and inert unless armed; Funcdata::vararg_folded, the register-save stores the
varargsave fold removes; kuna_narrowext::rules_for for a given mode;
IfaceStatus::last_command; and interface::quote_filename, moved from kuna-cli
so other callers can reach it. With every hook unset kuna's output is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inst the machine code

kuna-verify runs a function's SLEIGH p-code and kuna's final Funcdata from
the same random machine state, and compares the calls each makes and their
arguments, the memory written outside the frame and the value returned.
`check` runs it on functions of a binary, `corpus` on every decompile the
datatest corpus makes, and `mutate` plants faults on kuna's side to measure
how many the check catches. Slices C1, C2 and C4 of the diffverify proposal.

Rule localization, concolic inputs, single-instruction (Tier L) and
symbolic (Tier S) checks, the function oracle, the calling-convention model
check and the CI baseline come in their own changes. Every corpus verdict
matches the unsplit tool's on the same base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… which a function differs

For a function kuna-verify finds DIFFERS, `localize` holds one rule back at a
time through the rule cap and bisects how many of its applications are
allowed, so that with k - 1 the function agrees over every run and with k it
differs. It reports those applications by rule and address, under the same
contract and options as `check`. Slice C3 of the diffverify proposal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sjkim1127
sjkim1127 force-pushed the diffverify-localize branch from ce7c55b to adc86b9 Compare December 5, 2026 01:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant