Repository navigation
[AUTOMATED] diffverify: kuna-verify, differential semantic checking (C1–C5, Tier L, CI baseline) - #1830
[AUTOMATED] diffverify: kuna-verify, differential semantic checking (C1–C5, Tier L, CI baseline)#1830sjkim1127 wants to merge 99 commits into
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>
Both sides now load and store anywhere and run the same stub at each call: it records kuna's arguments and the memory the callee could read, kills the registers the model kills, and lazily rewrites the image's writable data and memory near pointers passed so far. INDIRECTs move after the op they guard. Where kuna has no call to code in the image, the machine runs the callee itself. Calls are compared on the instruction address; arguments are DIFFERS against a declared callee prototype and PROTOTYPE_SUSPECT otherwise. Switch rows now map to out-edges through the jump table, not by address. A fault injected in a local build for Noelo-Lab#801 and for a call that keeps a global across it both give DIFFERS; the default build agrees. Over the corpus, every C1 verdict is unchanged; 2,482 agree, 500 differ (untriaged, C4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A callee in the image of one of kuna's calls now runs for real on the machine side, inside a step cap, and the decompiled side replays what it did: memory writes, the calls it made, and the killed registers it left. Registers the convention preserves are restored and a change to one is reported as a suspect; a callee the model cannot run falls back to the stub. Callees kuna inlined run in an inline mode whose calls are kuna's. Harness fixes found while triaging: tail calls only to targets outside the function (SPARC delay-slot calls), memory INDIRECTs write their input before the guarded op, address-less synthesized calls are a declared divergence, context-tracked registers and bool parameters constrain the inputs, arguments are compared only at the callee prototype's storage, a large frame stays in the stack region, and differences after a doubtful argument or a read of an uninitialized local are UNKNOWN, not DIFFERS. --trace prints both sides' calls. DIFFERS over the corpus: 500 -> 118. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Harness fixes from triaging the corpus: a call value kept in a temporary is read from the register a copy moves it to; a return folded to a constant is compared at the register the model returns its type in; stack bool parameters start as 0 or 1; real callees spend a step pool of their own; the MIPS ISA bit is dropped from computed targets; a return to a pushed address continues there; a read of the frame is undefined only when both sides read bytes C leaves undefined, the stub's return-address slot and callee-saved spills included. From review: a run that traps on both sides is no longer counted as agreeing; a declared return divergence no longer skips the memory comparison; a call kuna resolved to a direct one is compared against the machine's target when both are code; --runs 0 is a usage error and a file that cannot be checked exits 3. Over tests/datatests + tests/stages: 2,952 agree, 29 differ, all triaged in docs/features/diffverify/c4-results.md: 5 kuna bugs, 8 passes a test pins on purpose, 3 source-level UB, 13 harness limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Really like this PR. Wanted to help: Result: Seven outstanding findings; issue #8 is fixed. Original numbering is retained. These findings apply to the pinned commit (805eac3) and were re-validated after finding. Note that issue #1 deliberately mutates decompiled output to test the verifier's ability to detect an error; it does not claim the decompiler naturally produces that mutation. Outstanding issues1. [P1] Stack objects passed to callees are omitted from comparisonRoot cause: Call snapshots reuse an exit-time memory filter that excludes stack bytes, including initialized locals whose addresses are passed to a callee (state.rs:569). Simple example: Machine code represents 2. [P1] Empty loops escape the execution budgetRoot cause: The graph runner increments its step counter only for operations in Simple example: An empty block whose only successor is itself keeps running indefinitely despite a budget of 1,000 steps. 3. [P2] External-call stubs violate narrow-return ABI rulesRoot cause: The call stub fills the entire output register with independent random bytes without applying the declared return type's ABI extension rules (state.rs:589). Simple example: With unmapped 4. [P2] Stub fallback destroys registers preserved by the calleeRoot cause: The fallback's Simple example: A caller keeps 5. [P2] Abbreviated decompile commands silently omit verificationRoot cause: The callback checks the raw command for the exact word Simple example: A corpus case using 6. [P2] Pointer contracts select integer return registersRoot cause: Contract return types lose their pointer category, and ABI assignment chooses only signed or unsigned integer types of the same width (abi.rs:86). Simple example: 7. [P2] Failed function loads reuse the previously selected functionRoot cause: A failed name lookup leaves the previous function selected, while error recovery clears only console flags and continues to the queued decompile command (session.rs:71). Simple example: Fixed issue8. [Fixed; previously P2] Corpus file errors returned a successful exit statusOriginal root cause: Corpus file errors were collected separately and omitted from the exit-status calculation; the revised calculation now returns 3 when file errors exist and no function differs (kuna-verify.rs:167). Simple example: |
|
Thank you for your feedback! I'll incorporate your suggestions. |
A local whose address a call receives is now compared at the call, within the extent of kuna's local symbol for that address: kuna's side finds it among the CALL op's inputs, the machine in the convention's argument registers, and only objects both find are compared. A callee run for real counts only the bytes it read, bytes a callee's code left in the object are skipped, and the stub writes only that object, no longer a window that reached the stack canary. An in-image callee the model cannot run that gets a frame object makes later differences UNKNOWN(guessed-callee). Also: block visits and empty instructions spend the step budget; a stub extends a narrow return as `narrowext abi` documents; it kills what the call's own effect list says, keeping registers kuna proved preserved; abbreviated decompile commands are checked (the console records the command a line resolved to); pointer contracts select the model's pointer storage; a decompile after a failed load is not checked. Corpus: 4,030 functions (51 more, from abbreviated commands), 2,977 agree, the same 29 differ. A local mutation storing 2 for 1 in a passed local now gives DIFFERS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
[AUTOMATED] Thanks, all seven are fixed in 70310cb, keeping your numbering. Over
#1 and #7, plus the empty loop and the abbreviation, have tests in |
Each fix whose stage fixture the check can run was put back in a local build (never committed) and its fixture checked. Of the 22 that restore a semantic bug, 5 are caught without a contract and 9 with one. The misses are classified in c4-results.md §6: a callee run for real shares its effect, so a dropped argument changes nothing; storage kuna never initialized holds the machine's value; a void or too-narrow return compares nothing without a contract; a frame object at a callee that reads nothing; no read-only store check; and C that is false but runs the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
At commit
|
…w's fixes Two checks for the recall misses. A callee the machine runs for real has the argument-register bytes it reads before writing them recorded (stack spills excluded); kuna's call inputs are placed by the callee's parameter storage, an entry-register input's own, or integer-register order, and register pairs by their pieces. Where kuna passes other bytes or none, the machine is rerun with kuna's bytes; only a changed result is DIFFERS, and a declared callee prototype makes it a suspect. kuna's side is also rerun with other values in what its C never assigns: argument or scratch registers read at entry with no parameter, and killed registers read after a call. A changed result is DIFFERS unless the machine, given the same values, changes too. From review: stubs keep the registers calleepreserves proves a callee leaves; frame objects passed to any earlier call are compared at later ones; direct call targets are compared through thunks, except calls kuna bound past a PLT stub or replaced by an injection; __int128 contracts are 16 bytes and an unknown type word is an error; a register return address written by calls no longer reads as a smashed frame; an empty script line clears the resolved command; a missing corpus path is a usage error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s own result counts A killed register the binary reads after a call is the binary's own dependence only when it is not a register the call returns in: there the binary reads the callee's value and kuna's C, never connecting it, reads nothing. And given kuna's arguments, a callee run for real that returns or writes something else makes the call differ even when the caller ignores the result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
[AUTOMATED] Thanks again, all seven are fixed in affaf9f (numbering kept):
The same commits add two checks for the gaps the recall measurement found ( |
The image is read and cached a page at a time, with pages the loader does not map whole read a byte at a time as asked; preserve_registers marks the kept ranges once instead of scanning them per byte; temporaries live in a hash map that keeps its capacity across instructions; thunk resolution is cached per function; and a function stops after 16 runs that hit an operation the model cannot run, as one that runs out of budget does. Over tests/datatests + tests/stages every verdict is unchanged; total CPU for the corpus falls by about a quarter, the checker's own time by about half. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Float ops run on IEEE single and double through the shared OpBehavior table; sign changes and a NaN's format conversion are exact bit operations that keep its payload. A call input that sits in a float argument register is placed there. 242 more corpus functions are judged (2,932 to 3,174 agree); the 15 new DIFFERS are triaged in c4-results.md 6c, among them kuna's ARM and AArch64 NaN compares and dropped float arguments. A float return that differs only in a NaN's quiet bit matches the nan-quieting divergence, nanignore's round-trip identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
[AUTOMATED] Review of 1.
|
…ake a jump to the continuation as a return ARM's cspec lists lr and pc as unaffected, so a callee's own call or return read as changing them and ARM functions became UNKNOWN(abi-violation). Both are left out of the registers put back. A callee returning with an indirect branch to its call's continuation (ARM `ldr pc, [sp], Noelo-Lab#8`, x86 `pop rcx; jmp rcx`) was followed as a jump inside the callee, so the caller ran on as the callee and its epilogue read as the callee changing r4-r11. Such a jump is a return now. On 18 decbench ARM binaries: 129 UNKNOWN(abi-violation) -> AGREES, 14 to another UNKNOWN reason (12 budget, 1 unsupported-op, 1 callee-replay: u-boot load_elf_image_phdr, a replay doubt the false violation hid), 2 -> DIFFERS (betaflight sqrt: kuna passes __aeabi_ddiv two words of its four), 1 AGREES -> UNKNOWN(budget) (_dtoa_r, whose body had run on the callee step pool). Corpus, ls O0, find O2 and uname O2 unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- An argument kuna passes in part of a register (AArch64 `(int4)p` in x0) to a stub callee with a recovered prototype is now a suspect when the machine's register holds more than that part extended. It reads the argument's trial storage when the prototype has no parameter there. The suspect is a lead only: it does not turn a run that differs into UNKNOWN. - kuna-verify no longer embeds its build directory: specs are looked for as kuna looks for them (the checkout from decompiler/target, beside the binary, the current directory). - The function oracle sets CR4.OSFXSR and CR4.OSXMMEXCPT after choosing the CPU model; Unicorn 2.1.4 leaves CR4 at 0 and traps on every SSE instruction. - CI installs z3 and Unicorn and runs the scripts/diffverify tests (`make test-diffverify-tools`); KUNA_REQUIRE_Z3 makes the Rust solver tests fail instead of passing when z3 is missing. - `check --all` on a binary with no functions and a load that produces no image are errors that say so; a misplaced doc comment in funcdata.rs is back on get_heritage_pass. - docs/baseline-verify.json is re-recorded in the versioned format for the 45 stage files main added. Three of them differ: getopt_long in kuna-passthroughfwdstack's `passthrough off` pass, and sst_tail in kuna-passthrough-filegap and its ARM twin, where kuna's call drops the double argument `sst` reads (a kuna finding, recorded as DIFFERS). Corpus, uname O2, ls O0 and find O2 verdicts are unchanged; the new suspect appears on 2 functions there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test used the review's AArch64 veneer, whose (int4)p was a kuna bug that main's kuna_wholeinputarg (Noelo-Lab#2035) now fixes, so on the merge with main the suspect was gone. It now uses the x86-64 thunk from kuna-protoorder-tailcallees, which forwards its recovered int in the low half of RDI. CI's oracle-script step also installs clang, lld and llvm, which the cross-backend fixture needs to build. docs/baseline-verify.json is re-recorded for the new stage tests from main; no existing verdict moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
[AUTOMATED] Thanks. All five are addressed in 292321f, plus 9895b3c on top of a merge with main (numbering kept):
Smaller: the doc comment is back on Model: claude-opus-5-5 |
The 1 MiB output limit was checked only after the solver exited, so a solver that kept printing filled its temporary files until the deadline. The poll loop now kills it as soon as stdout or stderr passes the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both sides of diffverify take argument and return storage, preserved registers and stack cleanup from the same .cspec, so an error there is invisible to Tier C. `kuna-verify abi-model` prints what kuna's model assigns for a declared prototype; scripts/diffverify/cspec_check.py builds probe callers, callees and a register-pressure function with clang for x86-64, i386, AArch64, ARM hard and soft float and RISC-V 64, runs them under Unicorn and compares. Everything agrees except ARM hard-float back-filling: AAPCS-VFP puts a float in an s register a double skipped, and kuna's model takes s registers in order (recorded in cspec_known.json). The tests plant a fault of each kind in kuna's x86-64 model and check it is reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A storage the script cannot read, a probe kuna did not decompile, or a run that faulted or ran out of steps is `unsupported` and fails the run. Every run must end where it should (a callee back at its return address) before its registers count. - A known finding must match in kind and text; a known entry whose finding changed (`changed`) or now matches (`fixed`) fails, so a new fault cannot hide behind an old one. - `killedbycall` is checked: a call clobbering only those registers must leave the result alone, and no register may be in both lists. - The preserved-register probe is split into integer and floating-point ones whose values come from calls and are combined with a value known only after the call. The old one let clang recompute or fold its values, which left ARM's r5-r11 and d8-d15 untested. Each unaffected register is now checked to be exercised; RISC-V gp and tp are reported as unexercised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Profiling `check` on find O2 put most of the time in what every call does, not in executing p-code: - the no-return name check looked the callee's name up, through thunks, and matched it against every list at each call of each run; it is now worked out once per target and cached in Env; - forgetting the memory a callee may write asked every written byte; a frame page no escaped pointer reaches is now kept whole; - finding the frame pointers stored in memory read each word a byte at a time through the page map; a word inside one page is now read with one lookup; - the cache of kuna's frame objects is a hash map instead of a B-tree. Instructions retired on find O2 (659 functions, one process) fall from 439.6e9 to 356.6e9, 19% fewer. Every verdict on the corpus, uname O2, ls O0 and find O2 is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ritable bytes by page - `State::writes` collected the written bytes in hash order into a B-tree, which sorted them all at every call. The pages are sorted instead, 64 times fewer, so the map is built from bytes already in order. - Forgetting what a callee may write now decides a frame page, or one outside `ram`, with one mask of the bytes an escaped pointer reaches, unless the page also holds read-only data or code. Instructions retired on find O2 (659 functions) fall from 356.6e9 to 338.9e9. Against the build before 548466f, with both changes: find O2 439.6e9 -> 338.9e9 (23% fewer), the corpus 3.39e12 -> 3.25e12, and `mutate` on uname O2 133e9 -> 122e9. Every verdict and every mutant's outcome is unchanged when both builds run with the same `--jobs`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
[AUTOMATED] Thanks for the follow-ups on the last review. With #1947 and #1948 stacked on it, this has grown into a subsystem that is hard to review and land as one piece. Could you split it?
The z3 concolic mode, any QEMU step, and #1947/#1948 would then follow as their own PRs. One question for the CI piece: the baseline pins DIFFERS verdicts too, so as it stands every PR that changes decompiler output would also have to re-record it. |
… evaluate common integer ops without the behavior table A mutant changes only kuna's side, so mutate now builds a function's setup once and reuses the machine's runs of the unmutated check; a noreturn mutant reuses only runs that never reached its call. eval takes the integer ops runs spend most time in (operands of at most eight bytes) through a direct port of the behavior table's arithmetic, checked against the table by a unit test. Verdicts on the corpus, uname O2, ls O0 and find O2 and all 419 uname O2 mutant outcomes are unchanged. Retired instructions: mutate uname O2 122e9 -> 90e9, check find O2 339e9 -> 325e9, corpus 3.25e12 -> 3.20e12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check compared the bits in kuna's storage with the marker. A compiler that builds a constant in a scratch register can leave the same bits in a register the other side never reads: clang 22 materialises the double of RISC-V `struct S_ld` through a1 (`fmv.d.x fa0, a1`), so kuna's a0 + a1 model passed locally and failed in CI under clang 21. The sinks and new `use_*` probes now store what they receive, and each register and stack slot is changed in turn to see which stored values change. A match needs the spots the code reads to be kuna's storage, and that storage to hold the marker. Findings no longer quote leftover register contents, so a known entry holds across compiler versions. A return that does not come back no longer falls through to the location comparison. The RISC-V lp64d structure of one integer and one floating-point field (a0 + fa0, which riscv64-fp.cspec joins as a0 + a1) is a kuna model gap, listed in cspec_known.json with its cause. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
[AUTOMATED] Split as asked, in that order. Each PR targets main and carries the commits of the one before it, so each says which commit to review from:
On the baseline question: a PR that changes decompiler output does not have to re-record it. Only a new difference fails the step, meaning a function that agreed (or a new function) now differs, or a file can no longer be checked. A function that already differed and still differs passes. #2110 now records where it first differs ( The z3 concolic mode, Tier L (with the objdump and radare2 checks for targets Unicorn does not run), Tier S, the function oracle and the cspec check will follow one at a time once these land, and #1947 and #1948 will be rebased onto them. The cspec check found that kuna's RISC-V lp64d model passes a |
[AUTOMATED]
DiffVerify is Kuna’s developer tool for finding decompiler regressions that change program behavior. Give
kuna-verify checka binary and a function. It runs the function’s SLEIGH p-code and Kuna’s final IR from the same sampled machine states. When they disagree, it reports the input and what each execution did.The ARM fixture from #794 shows how an incorrect return type changes a 64-bit result.
Omit
--option returnpair singleto getAGREES(256).What DiffVerify checks
Tier C compares function calls and arguments, observable memory writes, and return values. Use
check --allfor a whole binary andcorpusto track verdicts against a regression baseline.localizesuggests decompiler rules to inspect,--concolicsearches for inputs that reach new paths, andmutatemeasures detection of deliberate IR changes. Tier L cross-checks individual instruction semantics against Unicorn. Usage guideThe function oracle compares Unicorn execution of fixed-address x86-64 ELF bytes with raw p-code and final IR.
provechecks returns and memory with SMT. It supports bounded loops and induction for selected single-header x86-64 loops that carry register or shared-memory values. Sail provides an independent reference for selected RV64 integer instructions. Function oracle · Symbolic validation · Sail RV64Evidence and limits
SMT proof certificates can be checked with cvc5 and Ethos. The evidence records the proof's assumptions and bounds. Proof certificates
The published DecBench run covered 49,184 functions. Tier L covered 8,805 instruction forms. Mutation testing caught 76% of reached corpus mutants. DecBench · Tier L · Mutation testing
AGREES(n)meansnsampled runs agreed. Tier C’s two executions share SLEIGH and p-code semantics. Its coverage excludes emitted C and writes to caller-owned stack objects at function exit. Coverage and verdictsModel: Claude Opus 5.5, GPT-6.2 Sol