论文标题
通量:生锈的液体类型
Flux: Liquid Types for Rust
论文作者
论文摘要
我们介绍了Flux,它显示了逻辑改进如何与Rust的所有权机制一起手套,以产生基于人体工程学类型的低级指针操纵程序的验证。首先,我们为Rust设计了一种新颖的精制类型系统,该系统索引了可变的位置,具有纯净(不可变的)值,可以出现在改进中,然后利用Rust的所有权机制来抽象的亚构造理由,涉及Rust的多态性构造函数中的位置,同时支持强大的更新。我们通过利用堆叠式货物的混叠模型来证明``借入良好的计划的评估不会被卡住''正式对Rust对Rust的强大别名保证的关键依赖性。其次,我们以Flux的形式实现了类型系统,该系统是Rust编译器的插件,该插件将复杂不变性的分解为类型和改进,以有效合成循环注释 - 包括描述容器内容的复杂量化不变性剂 - 通过液体推理。第三,我们通过基准的矢量操纵程序和先前验证的安全沙箱库的一部分评估通量套件,以证明改进类型的优势比最先进的Prusti验证器中实现的程序逻辑。虽然普鲁斯蒂(Prusti)更具表现力的程序逻辑通常可以验证深度功能正确性规格,但可以通过我们的基准测试涵盖的轻巧但无处不在且重要的验证用例,但液体键入使符合人体工程学通过将规格划分为两个因素,以两倍的验证时间,验证时间为两个尺寸,高度和24%的代码(平均数为24%)(平均数为24%)(平均9%)。
We introduce Flux, which shows how logical refinements can work hand in glove with Rust's ownership mechanisms to yield ergonomic type-based verification of low-level pointer manipulating programs. First, we design a novel refined type system for Rust that indexes mutable locations, with pure (immutable) values that can appear in refinements, and then exploits Rust's ownership mechanisms to abstract sub-structural reasoning about locations within Rust's polymorphic type constructors, while supporting strong updates. We formalize the crucial dependency upon Rust's strong aliasing guarantees by exploiting the stacked borrows aliasing model to prove that ``well-borrowed evaluations of well-typed programs do not get stuck''. Second, we implement our type system in Flux, a plug-in to the Rust compiler that exploits the factoring of complex invariants into types and refinements to efficiently synthesize loop annotations -- including complex quantified invariants describing the contents of containers -- via liquid inference. Third, we evaluate Flux with a benchmark suite of vector manipulating programs and parts of a previously verified secure sandboxing library to demonstrate the advantages of refinement types over program logics as implemented in the state-of-the-art Prusti verifier. While Prusti's more expressive program logic can, in general, verify deep functional correctness specifications, for the lightweight but ubiquitous and important verification use-cases covered by our benchmarks, liquid typing makes verification ergonomic by slashing specification lines by a factor of two, verification time by an order of magnitude, and annotation overhead from up to 24% of code size (average 9%) to nothing at all.