Verifying the Rust Standard Library
Summary
A large-scale, crowdsourced effort is underway to formally verify the Rust standard library, integrating complementary verification tools like Kani, ESBMC, VeriFast, and Flux into continuous integration. Launched in November 2024, this campaign aims to prove the absence of undefined behavior (UB) across the library's approximately 34,000 functions. A key development, Autoharness, automatically generates proof harnesses at Rust's MIR intermediate representation level. Autoharness produced 16,748 harnesses, with 11,970 successfully verified against Kani's supported UB classes. Overall, 989 functions were verified against formal function contracts. While no new memory safety vulnerabilities were found, the project identified specification inconsistencies and documentation errors, contributing to the adoption of function contracts as an experimental Rust language feature.
Key takeaway
For software engineers building safety-critical Rust systems, this verification campaign demonstrates that machine-checked proofs for the standard library are achievable. You should consider adopting formal contracts for your own "unsafe" code, utilizing tools like Kani for automated harness generation. Be prepared for the engineering overhead of integrating diverse verification tools and managing community contributions, treating these as critical project milestones.
Key insights
Large-scale, crowdsourced formal verification of the Rust standard library is feasible using multi-tool continuous integration.
Principles
- Verification requires community consensus.
- Tool diversity is essential for coverage.
- Formal specifications clarify safety.
Method
The project uses a crowdsourced challenge program with financial rewards, integrating tools like Kani and VeriFast into CI. Autoharness automatically generates proof harnesses for symbolic execution.
In practice
- Integrate multiple verification tools.
- Automate proof harness generation.
- Define formal function contracts.
Topics
- Rust Standard Library
- Formal Verification
- Undefined Behavior
- Kani Model Checker
- Continuous Integration
- Crowdsourced Verification
- Software Safety
Code references
Best for: AI Scientist, Research Scientist, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.