Repository navigation
Conversation
…nd kuna
[AUTOMATED] Design only. Adds docs/features/diffverify/{analysis.md,
proposal.md,record.json}: a dev-only kuna-verify crate that checks, per
function, that kuna's Band B p-code computes what the lifted p-code computes
(z3 over SMT-LIB 2), that the lift matches the machine (Unicorn/qemu-user),
and later that the printed C matches the binary. No engine or emitted-C change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…age honestly [AUTOMATED] Reorders the tiers: concrete execution of the binary (EmulatePcodeCache) against the finished Funcdata (an interpreter on EmulatePcodeOp) comes first and needs no phase hooks; z3 proves only functions that already agree. Classifies the 56 P3/P4 fixes since June (~15 body rewrites, ~29 prototype/ABI claims, ~12 not visible) instead of claiming all of them, spells out why equivalence is hard, and adds a declared-divergence list keyed by option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[AUTOMATED] Adds how Noelo-Lab#1534's symbolic p-code emulator, the Noelo-Lab#1641/Noelo-Lab#1699 phase hooks, the Noelo-Lab#317 ghidra-sim harness, the per-PR compile-and-compare oracles and DecBench byte_match relate to this proposal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… loop-free code Tier S now runs every proof under a deterministic budget (z3 rlimit, unroll and query caps; wall clock only as a safety net) and unrolls loops to a bound, reporting EQUIVALENT(<=k) for bounded proofs. The spent budget is recorded in the baseline, so a change that makes a function exhaust it is flagged as a regression. angr or binsec may encode the machine side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One p-code-to-SMT encoder serves both sides, a sat model replays exactly in Tier C, and no second lifter toolchain is needed. Independence from SLEIGH stays with Tier L. Closes the open question on angr or binsec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D-Helix (USENIX Security 2024) is the closest prior design. The proposal now cites it and says where it differs: no recompilation for Tier C, stores and calls observed besides the return value, prototype read through the ABI (the cause of all D-Helix false negatives), concrete call replay, globals from the load image, and culprit search over fired rules only. Also: identical scratch addresses on both sides; localization rejects subsets that add a difference, reports when no rule set explains one, and tries past culprits first; a Cost section; C1-C3 now measure time, bisection cost, precision and recall (reverted fixes); Tier P expectations from D-Helix's recompile rates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… honest bounds - Return values: compare only the bytes the physical ABI defines for the claimed type; a width or signedness verdict needs a typed contract (fixture source, DWARF). Noelo-Lab#794 is a DIFFERS against its source's u64 contract. - Inputs: both sides start from the same raw state; an undeclared live-in is PROTOTYPE_SUSPECT, not a poison-induced DIFFERS. - Calls: stubs write reachable memory and the decompiled side replays it; Tier S models calls as (regs, memory) -> (regs, memory) and never encodes a function Tier C could not fully execute. - The Funcdata interpreter is new work; EmulateFunction's stores are no-ops. Unsupported ops give UNKNOWN(unsupported-op). - EQUIVALENT(<=k) covers inputs on which both sides finish within the bound; one-sided overruns are replayed, not dropped. Unreplayable sat models are separated from encoder bugs. - Localization reports a 1-minimal candidate set; log2 k only for a single culprit. - Declared divergences are predicates (option, arch, observable, pattern). - Slices: C1 pure integer, C2 memory and calls, C3 localization, C4 corpus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts, register-only C1 - Tier S admission no longer rests on Tier C's sampled runs: every op reachable in both CFGs must have complete SMT semantics and every call's reachable memory must be bounded, else SKIPPED(unencodable). - A call stub's reachable memory includes every writable global, not only pointer arguments and escaped memory. - C1 is register-only leaf functions (no memory access except read-only image loads); C2 adds stack, pointer-argument and global memory. - record.json measurements follow the C1-C4 slices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unresolved indirect branches and calls, jump tables without a proved bound, and unproved no-return calls make a function SKIPPED(incomplete-cfg). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one state Add the dev-only kuna-verify crate. The machine side lifts each instruction with the program's SLEIGH translator and evaluates it with the OpBehavior table; the decompiled side interprets the final Funcdata. Both start from the same raw state, with argument registers extended as the ABI documents. Return values are compared under the physical ABI and, given C source, against a typed contract. Calls and memory beyond the frame are SKIPPED (slice C2). Reverting Noelo-Lab#794 (returnpair single) gives DIFFERS against its source contract. Over tests/datatests and tests/stages: 3,979 functions, 4 DIFFERS (3 are the narrowext bug its stage test pins, 1 is a relocation harness limit), 3 DIVERGES (switchrunon-cut-row). Results: docs/features/diffverify/c1-results.md. kuna_narrowext::rules_for exposes the rules for a given mode; rules() is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Random inputs rarely reach a branch on one value. A small symbolic executor records branch conditions over the inputs on both sides, and z3 supplies inputs that take the other side; verdicts still come only from concrete runs. C5 follows C2 and precedes S1, which reuses its expressions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/features/diffverify/proposal.md
The decompiled function is compiled into a flat program every run reuses, registers live in a dense memoized file, and a function stops after four runs that exhaust the step budget. `corpus` runs one worker process per core and prints in file order; `--json` and `check --all` are new. Stage tests pin the harness fixes found while building C1. Every verdict over tests/datatests and tests/stages is unchanged, sequential and parallel. Check time 49.8 s -> 3.6 s; wall time 111 s -> 20.6 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
[AUTOMATED] Folded into #1830, which carries this branch's commits plus slice C2 and a fix for switch rows that this branch maps to the wrong out-edge. The later slices will land there too. |
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]
The first slice (C1) of the diffverify proposal in #1714: a dev-only
kuna-verifythat runs a function's machine code and kuna's decompiled function from the same state and compares what they return. This branch sits on #1714's commits, so the proposal documents show up in the diff too.On #794's fixture, the pre-fix behavior (
returnpair single) differs from the source's prototype, and the fix agrees:Without
--option returnpair singlethe same command printsAGREES(256). Without--contractit also agrees, addingPROTOTYPE_SUSPECTbecause the machine setsr1to 0 on every run. The binary alone cannot settle a prototype.The change
decompiler/crates/kuna-verifyis a new crate, not linked into the release binary. The machine side lifts each instruction with the program's SLEIGH translator and evaluates it with kuna'sOpBehaviortable. The decompiled side interprets the finalFuncdata. Both start from the same random state, and argument registers are extended as the ABI documents (narrowext abi).SKIPPED. Floating point and unmodeled user ops areUNKNOWN.kuna-verify corpus <dir>checks every function a datatest script decompiles, under that script's options.kuna_narrowext::rules_foris new, so the documented rule can be asked for regardless of the run's option.rulesis unchanged.Results
Over
tests/datatestsandtests/stages(3,979 decompiled functions, 256 runs each):narrowext offpass thatkuna-narrowext.xmlpins as the bug; itsabipass agrees. The fourth is a known limit with relocated immediates.--jobs).--jsonandcheck --allprint every verdict for a script or a whole object.Details and triage:
docs/features/diffverify/c1-results.md.make testandmake test-stagesare at parity.Model: Claude Opus 5.5
🤖 Generated with Claude Code