Kani: A Model Checker for Rust
Kani: A Model Checker for Rust
Kani is an open-source model checker for Rust designed to provide formal correctness guarantees for properties that the Rust compiler's ownership type system cannot verify, such as the soundness of unsafe operations, functional correctness, and the absence of runtime panics. By compiling Rust's Mid-level Intermediate Representation (MIR) into the CBMC bit-precise verification engine, Kani enables developers to verify safety properties automatically without requiring user annotations.
Bounded and Unbounded Verification
Kani provides two levels of verification: bounded model checking and unbounded verification. Bounded model checking allows for the tool to automatically check a comprehensive set of safety properties without user intervention. For more complex properties requiring unbounded verification, Kani introduces a specification language that includes function contracts, loop contracts, quantifiers, and function stubbing.
Technical Implementation
Kani's architecture compiles proof harnesses from Rust's Mid-level Intermediate Representation (MIR) into the logic used by the BMC bit-precise verification engine. This process allows Kani to verify the code's behavior across all possible inputs within defined bounds, bit-precisely,it is used to check for memory errors in unsafe code, raw pointer dereferences, and runtime panics.
Industrial Application and Scale
Kani has been demonstrated to be feasible for industrial-scale Rust projects. In specific case studies, the use of contracts upgraded verification from simple panic-freedom to full functional correctness, which led to the discovery of six previously unknown bugs.
Kani is currently operating at scale in production CI environments. In the Rust standard library verification campaign, Kani verifies over 16,000 harnesses per code change, demonstrating its ability to integrate into modern software development workflows at scale.
Academic Recognition
The research behind Kani was accepted at the 39th IEEE/ACM International Conference on Automated Software Engineering (ASE 2026), Industry Showcase Track.