paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Kani: A Model Checker for Rust

Kani:面向 Rust 的模型检测器
ASE Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering2026匹配度 3/10 · 论文是 Rust 模型检测器 Kani,属于形式化验证工具,但未涉及用户核心关注的 LLM/Agent、浮点程序分析或贝叶斯程序分析,也不涉及将静态分析应用于机器学习系统,因此匹配度较低。引用 2 inbox
Rémi Delmas, Zyad Hassan, Qinheping Hu, Rahul Kumar, Felipe R. Monteiro, Thanh Nguyen, Adrián Palacios, Celina Val, Michael Tautschnig, Justus Adam, Daniel Schwartz-Narbonne, Carolyn Zech
crossref: 2026-10-09

AI 速览

一句话:Kani 是开源 Rust 模型检测器,从 MIR 编译证明 harness 到 CBMC,无需标注即可验证安全性并用契约扩展到无界功能正确性。

Rust 的所有权类型系统可排除安全代码中的内存错误,但 unsafe 操作的健全性、函数正确性与无 panic 等性质仍不在编译保证范围内。Kani 是开源的 Rust 模型检测器,将有界模型检测从缺陷发现推进到对上述性质的正确性保证:它从 Rust 的 Mid-level IR(MIR)编译证明 harness 并交给 CBMC 的位精确验证引擎,无需用户标注即可自动检查一组全面的安全性质;为把验证从有界扩展到无界,Kani 提供了由函数契约、循环契约、量词与函数打桩构成的规约语言。在工业 Rust 项目上的案例研究表明,契约把验证从无 panic 提升到功能正确性,并发现六个此前未知的缺陷;Kani 已在生产 CI 中大规模运行,在 Rust 标准库验证活动中每次代码变更验证超过 16,000 个 harness。

问题
Rust 的编译期保证并不覆盖 unsafe 操作的健全性、函数正确性以及运行时 panic 的缺失,这些性质需要编译之外的手段来验证。
方法
Kani 从 Rust MIR 编译证明 harness,交由 CBMC 的位精确有界模型检测引擎自动检查安全性质,并提供函数契约、循环契约、量词与函数打桩等规约机制以支持无界验证。
评估
作者在工业 Rust 项目上开展案例研究,契约使验证从无 panic 升级为功能正确性并发现六个新缺陷;Kani 在生产 CI 中运行,在 Rust 标准库验证活动中对每次代码变更验证超过 16,000 个 harness。
原文摘要(Abstract)

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.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2607-01504,
  title = {Kani: A Model Checker for Rust},
  author = {Rémi Delmas and Zyad Hassan and Qinheping Hu and Rahul Kumar and Felipe R. Monteiro and Thanh Nguyen and Adrián Palacios and Celina Val and Michael Tautschnig and Justus Adam and Daniel Schwartz-Narbonne and Carolyn Zech},
  booktitle = {ASE},
  year = {2026},
  doi = {10.1145/3832783.3834499}
}