Kani: Rust 模型检测器
Kani: A Model Checker for Rust
AI总结:
提出开源模型检测器 Kani,通过将 Rust MIR 编译到 CBMC 引擎实现有界模型检测,支持无标注安全属性检查及函数契约等规范语言,在工业项目中验证了无恐慌到功能正确性的升级并发现6个新 bug。
摘要:
Rust 的所有权类型系统防止了安全代码中的内存错误,但某些期望的属性仍然与编译无关:不安全操作(例如原始指针解引用)的正确性、功能正确性以及运行时恐慌的缺失。我们提出了 Kani,一个开源的 Rust 模型检测器,它将有界模型检测从错误发现推进到为这些属性提供正确性保证。Kani 将 Rust 的中间级中间表示(MIR)中的证明框架编译到 CBMC 的位精确验证引擎中,自动检查一组全面的安全属性,无需用户注释。为了将验证从有界扩展到无界,Kani 提供了一种规范语言,包括函数契约、循环契约、量词和函数桩。我们通过工业 Rust 项目的案例研究证明了可行性,其中契约将验证从无恐慌升级到功能正确性,发现了六个以前未知的错误。Kani 在生产 CI 中大规模运行,在 Rust 标准库验证活动中每次代码更改验证超过 16,000 个框架。
英文摘要:
Rust's ownership type system prevents memory errors in safe code, but certain desirable properties remain orthogonal to compilation: the soundness of unsafe operations (e.g., raw pointer dereferences), functional correctness, and absence of runtime panics. We present Kani, an open-source model checker for Rust that pushes bounded model checking beyond bug-finding to provide correctness guarantees for these properties. Kani compiles proof harnesses from Rust's Mid-level Intermediate Representation (MIR) into CBMC's bit-precise verification engine, automatically checking a comprehensive set of safety properties with no user annotation. To extend verification from bounded to unbounded, Kani provides a specification language comprising function contracts, loop contracts, quantifiers, and function stubbing. We demonstrate feasibility through case studies on industrial Rust projects, where contracts upgraded verification from panic-freedom to functional correctness, uncovering six previously unknown bugs. Kani operates at scale in production CI, with over 16,000 harnesses verified per code change in the Rust standard library verification campaign.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。