Toolchain verifies Rust

Kani Rust Verifier

Also known as Kani

Write test-like proof harnesses for Rust code; Kani checks every input the harness allows, up to loop bounds, and gives a counterexample when a check fails.

Stage 1 · Usable Push-button Open source · MIT OR Apache-2.0 0.68.0 · 2 months ago
Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial CheckerSemanticsFrontendBinary gapEscape hatches 0 of 5 strong, 1 weak

Use it if

  • You want to check unsafe Rust for memory errors, overflow and panics without writing proofs.
  • Your code has small or known loop bounds, such as parsers, encoders or data-structure operations.
  • You want proofs that run in CI next to your tests.

Look elsewhere if

  • Your code is concurrent or async; Kani treats threads as sequential code and does not support await.
  • Your loops have no small bound and you are not ready to write (experimental) loop contracts; the result then only covers runs up to the bound.
  • You need to catch violations of Rust's aliasing rules or data races; Kani does not check them.

How it works

From your code to an accepted proof. Each step either has to be trusted or is checked by something else.

  1. Input
    Rust code
  2. Front end
    kani-compiler (rustc-based; translates MIR into a CBMC goto program) Trusted Uses rustc to compile the code and its dependencies, then Kani's own code generator turns the MIR into CBMC's input format. Features it cannot translate become a failing check if reached.
  3. Translation
  4. Checker
    SAT solver (CaDiCaL by default; MiniSat, Kissat, Z3, Bitwuzla or cvc5 selectable) Trusted The default may change between Kani versions.
  5. Compiler
    rustc / LLVM Trusted

Verified or checked: outside the trusted base Validated per run or by tests Trusted without proof

  • Rust: Checks proof harnesses (functions marked kani::proof); inputs come from kani::any() and are limited by the harness.

Trust

What a proof from this toolchain relies on: the trusted computing baseTrusted computing base (TCB). Everything that must be correct for a proof to mean what it says., one part at a time. How these are rated.

  1. Checker What has the final word on a proof?
    Partial

    CBMC and a SAT solver decide; no proof certificate. A proof only if unwinding checks pass.

    A harness result is a proof for every input the harness allows only when all unwinding assertions pass (they are on by default). If a bound is too small Kani reports an unwinding-assertion failure and marks other checks UNDETERMINED. Unsupported features become failing checks when reached, but concurrent code is treated as sequential with only a warning, and the unstable --restrict-vtable flag is a known soundness issue.

    source

  2. Semantics Is the tool's model of the language the real language?
    Partial

    Rust model built into Kani's code generator; tested by its own regression suite.

    Kani documents which kinds of undefined behavior it does not model, such as aliasing rules and data races.

    source

  3. Frontend How does your source get into the model?
    Partial

    rustc compiles the code; Kani's own unverified code generator translates MIR for CBMC.

    source

  4. Binary gap Does the proof cover what actually runs?
    Weak

    The binary comes from rustc and LLVM, which are not verified.

  5. Escape hatches Can a proof silently rest on unchecked assumptions?
    Partial

    kani::assume, stubs and contracts can hide bugs; some vacuous checks show as UNREACHABLE.

    Kani reports a check as UNREACHABLE for some assertion kinds when no execution reaches it, and kani::cover can test reachability. Over-constraining assumptions are otherwise found by reading the harness.

    source

What it can prove

Kinds of guarantees, not how easy they are to get.

Properties
FeatureSupportNotes
No undefined behavior Memory safety and absence of runtime errors: no out-of-bounds access, use-after-free, overflow traps, panics or undefined behavior on any input allowed by the precondition. PartialPartial.Checks by default: arithmetic overflow, division by zero, invalid pointer dereference, out-of-bounds indexing, panics, bad shifts and memory leaks. Not checked: data races, Rust's aliasing rules (Stacked or Tree Borrows), mutation of immutable data, inline assembly. Invalid values and uninitialized memory are checked only with unstable flags.
Source
Checks by default: arithmetic overflow, division by zero, invalid pointer dereference, out-of-bounds indexing, panics, bad shifts and memory leaks. Not checked: data races, Rust's aliasing rules (Stacked or Tree Borrows), mutation of immutable data, inline assembly. Invalid values and uninitialized memory are checked only with unstable flags. source
Functional correctness The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”. PartialPartial.Assertions in a harness are checked for every input the harness allows, but only up to the loop bounds unless the (experimental) function or loop contracts are used.
Source
Assertions in a harness are checked for every input the harness allows, but only up to the loop bounds unless the (experimental) function or loop contracts are used. source
Equivalence Two programs (an optimized and a reference version, or code before and after a change) are proved to behave the same, or one refines the other. PartialPartial.No dedicated mode; you write a harness that runs two implementations on the same symbolic inputs and asserts equal results, within the loop bounds.
Source
No dedicated mode; you write a harness that runs two implementations on the same symbolic inputs and asserts equal results, within the loop bounds. source
Information flow Secrets do not influence public outputs, timing or memory access patterns (constant-time code, non-interference). Not supportedNot supported.No information-flow or constant-time checking. No information-flow or constant-time checking.
Concurrency Correctness of code with threads or shared memory: absence of data races, deadlock freedom, linearizability of concurrent data structures. Not supportedNot supported.Concurrent code is out of scope; Kani emits a warning and compiles it as if it were sequential.
Source
Concurrent code is out of scope; Kani emits a warning and compiles it as if it were sequential. source
Termination and liveness Every run finishes, or the system keeps making progress (liveness). PartialPartial.Passing unwinding checks show that every loop finishes within the bound for the harness's inputs. There are no general termination proofs.
Source
Passing unwinding checks show that every loop finishes within the bound for the harness's inputs. There are no general termination proofs. source

Language coverage

Which parts of Rust it handles. Hover or focus a mark for details.

Common features

Common features
FeatureSupportNotes
Machine integers Fixed-width integer arithmetic, overflow and bit operations. SupportedSupported.Bit-precise machine integers with overflow checks.
Source
Bit-precise machine integers with overflow checks. source
Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. SupportedSupported.Bit-precise IEEE 754 arithmetic. sin, cos and sqrt are over-approximated, which is sound but can report errors that cannot happen.
Source
Bit-precise IEEE 754 arithmetic. sin, cos and sqrt are over-approximated, which is sound but can report errors that cannot happen. source
Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. SupportedSupported.Box, Rc and Arc are supported; null, dangling and out-of-bounds pointers are checked.
Source
Box, Rc and Arc are supported; null, dangling and out-of-bounds pointers are checked. source
Arrays and buffers Indexed memory such as arrays, slices, vectors and byte buffers. SupportedSupported.
Source
source
Loops Unbounded loops, which need invariants or bounds to verify. PartialPartial.Loops are unrolled up to a bound. Unwinding assertions fail if the bound is too small, so a passing run covers every execution of the harness. Without a bound Kani may not finish. Loop contracts (experimental) give unbounded proofs.
Source
Loops are unrolled up to a bound. Unwinding assertions fail if the bound is too small, so a passing run covers every execution of the harness. Without a bound Kani may not finish. Loop contracts (experimental) give unbounded proofs. source
Recursion Functions that call themselves, directly or through others. PartialPartial.Recursion is unrolled up to the bound like loops; function contracts (experimental) can replace recursive calls.
Source
Recursion is unrolled up to the bound like loops; function contracts (experimental) can replace recursive calls. source
Higher-order code Function pointers, closures and callbacks. PartialPartial.Closures and function pointer types are listed as partially supported. Unresolved function pointers are treated as a call to any function with a matching signature.
Source
Closures and function pointer types are listed as partially supported. Unresolved function pointers are treated as a call to any function with a matching signature. source
Threads and shared memory Concurrent threads with locks, atomics or message passing. Not supportedNot supported.Concurrent code is compiled as sequential code with a warning; data races are not detected.
Source
Concurrent code is compiled as sequential code with a warning; data races are not detected. source
I/O and system calls Files, network, system calls and foreign-function calls. UnknownUnknown.Kani replaces print macros with its own versions; support for file, network and other system calls is not documented.
Source
Kani replaces print macros with its own versions; support for file, network and other system calls is not documented. source
Standard library Specifications or models for the language's standard library. SupportedSupported.The real standard library is compiled into the model, except a few functions Kani replaces with its own models, which are then trusted.
Source
The real standard library is compiled into the model, except a few functions Kani replaces with its own models, which are then trusted. source

Rust-specific features

Rust-specific features
FeatureSupportNotes
References and borrowing Shared and mutable references checked by the borrow checker. SupportedSupported.References are handled like any other code, but Rust's aliasing rules are not checked.
Source
References are handled like any other code, but Rust's aliasing rules are not checked. source
Traits and generics Generic functions and types with trait bounds. SupportedSupported.Traits and implementations are listed as supported; type parameters as partial.
Source
Traits and implementations are listed as supported; type parameters as partial. source
Closures Anonymous functions that capture their environment. PartialPartial.Closure types are listed as partially supported.
Source
Closure types are listed as partially supported. source
unsafe and raw pointers Code inside unsafe blocks, raw pointer dereferences and FFI. PartialPartial.Raw pointer dereferences are checked, but aliasing violations and invalid values are not by default, and inline assembly is not supported.
Source
Raw pointer dereferences are checked, but aliasing violations and invalid values are not by default, and inline assembly is not supported. source
Interior mutability Cell, RefCell, UnsafeCell and other mutation through shared references. PartialPartial.Interior mutability is listed as supported, but UnsafeCell, which it is built on, is listed as partial.
Source
Interior mutability is listed as supported, but UnsafeCell, which it is built on, is listed as partial. source
Trait objects dyn Trait values with dynamic dispatch. PartialPartial.Trait object types are listed as partially supported.
Source
Trait object types are listed as partially supported. source
Iterators Iterator chains such as map, filter and for loops over collections. SupportedSupported.Iterator code is compiled like any other code; loops over iterators still need unwinding bounds.
Source
Iterator code is compiled like any other code; loops over iterators still need unwinding bounds. source
Panics Panicking operations (unwrap, indexing, overflow in debug builds) and their absence. SupportedSupported.All panic paths are checked. Stack unwinding after a panic is not modeled.
Source
All panic paths are checked. Stack unwinding after a panic is not modeled. source
async / await Asynchronous functions and futures. Not supportedNot supported.await expressions are listed as not supported.
Source
await expressions are listed as not supported. source

Stage

Computed from the evidence below; see the criteria. 1criterion is missing for Stage 2.

Stage 0 Research Met
  • Met: Publicly available evidence
  • Met: At least one published verification uses it Kani: A Model Checker for Rust (ASE 2026 industry track), with industrial case studies. evidence
Stage 1 Usable Met
  • Met: Released or updated in the last 12 months Latest release: 0.68.0, 2026-09-16. evidence
  • Met: Installs and runs on current platforms Release binaries for Linux and macOS (x86-64 and Arm). evidence
  • Met: User documentation or tutorial evidence
  • Met: Used by a group other than its authors Google's zerocopy crate applies Kani to prove parts of its implementation. evidence
Stage 2 Production Next
  • Not met: Verified code in production at two or more independent organizations 1 recorded: Amazon Web Services.
  • Met: Checker axis is not red
  • Met: Semantics axis is not red
  • Met: Public channel for soundness bugs Public GitHub issues with a "[F] Soundness" label. evidence

In use

Verified code in production, and notable verification projects.

In production

  • Amazon Web Services Firecracker's I/O rate limiter and VirtIO transport checked with Kani harnesses in CI; Firecracker runs AWS Lambda and AWS Fargate. source

Projects

Facts and sources

Effort
Push-button: Run it on your code; little or no annotation.
Licence
Open source, MIT OR Apache-2.0
Maintained by
Amazon Web Services (model-checking team)
Latest release
0.68.0 (16 Sep 2026) source
Last checked
26 Nov 2026

Further sources

esc