A hybrid approach to semi-automated Rust verification (2403.15122v1)
Abstract: While recent years have been witness to a large body of work on efficient and automated verification of safe Rust code, enabled by the rich guarantees of the Rust type system, much less progress has been made on reasoning about unsafe code due to its unique complexities. We propose a hybrid approach to end-to-end Rust verification in which powerful automated verification of safe Rust is combined with targeted semi-automated verification of unsafe~Rust. To this end, we present Gillian-Rust, a proof-of-concept semi-automated verification tool that is able to reason about type safety and functional correctness of unsafe~code. Built on top of the Gillian parametric compositional verification platform, Gillian-Rust automates a rich separation logic for real-world Rust, embedding the lifetime logic of RustBelt and the parametric propheciees of RustHornBelt. Using the unique extensibility of Gillian, our novel encoding of these features is fine-tuned to maximise automation and exposes a user-friendly API, allowing for low-effort verification of unsafe code. We link Gillian-Rust with Creusot, a state-of-the-art verifier for safe Rust, by providing a systematic encoding of unsafe code specifications that Creusot may use but not verify, demonstrating the feasibility of our hybrid~approach.
- How do programmers use unsafe rust? Proceedings of the ACM on Programming Languages 4, OOPSLA (Nov. 2020), 136:1–136:27. https://doi.org/10.1145/3428204
- Leveraging rust types for modular specification and verification. Proceedings of the ACM on Programming Languages 3, OOPSLA (Oct. 2019), 147:1–147:30. https://doi.org/10.1145/3360573
- A Tool for Checking ANSI-C Programs. In Tools and Algorithms for the Construction and Analysis of Systems (Lecture Notes in Computer Science), Kurt Jensen and Andreas Podelski (Eds.). Springer, Berlin, Heidelberg, 168–176. https://doi.org/10.1007/978-3-540-24730-2_15
- Kees Cook. 2022. [GIT PULL] Rust introduction for v6.1-rc1. https://lore.kernel.org/lkml/202210010816.1317F2C@keescook. Accessed: Nov. 16th 2023.
- Sound Automation of Magic Wands. In Computer Aided Verification (Lecture Notes in Computer Science), Sharon Shoham and Yakir Vizel (Eds.). Springer International Publishing, Cham, 130–151. https://doi.org/10.1007/978-3-031-13188-2_7
- Xavier Denis and Jacques-Henri Jourdan. 2023. Specifying and Verifying Higher-order Rust Iterators. In Tools and Algorithms for the Construction and Analysis of Systems (Lecture Notes in Computer Science), Sriram Sankaranarayanan and Natasha Sharygina (Eds.). Springer Nature Switzerland, Cham, 93–110. https://doi.org/10.1007/978-3-031-30820-8_9
- Creusot: a Foundry for the Deductive Verification of Rust Programs. Springer Verlag. https://hal.inria.fr/hal-03737878
- Nima Rahimi Foroushaani and Bart Jacobs. 2022. Modular Formal Verification of Rust Programs with Unsafe Blocks. https://doi.org/10.48550/arXiv.2212.12976 arXiv:2212.12976 [cs].
- Gillian, part i: a multi-language platform for symbolic execution. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2020). Association for Computing Machinery, New York, NY, USA, 927–942. https://doi.org/10.1145/3385412.3386014
- Unsafe Code Guidelines Working Group. 2023. Structs and Tuples - Memory Layout - Unsafe Code Guidelines. https://github.com/rust-lang/unsafe-code-guidelines/blob/50f8ff4b6892f98740de3b375e4d4bda10b9da9f/reference/src/layout/structs-and-tuples.md Accessed: Nov. 16 2019.
- Son Ho and Jonathan Protzenko. 2022. Aeneas: Rust verification by functional translation. Proceedings of the ACM on Programming Languages 6, ICFP (Aug. 2022), 116:711–116:741. https://doi.org/10.1145/3547647
- A Quick Tour of the VeriFast Program Verifier. In Programming Languages and Systems (Lecture Notes in Computer Science), Kazunori Ueda (Ed.). Springer, Berlin, Heidelberg, 304–311. https://doi.org/10.1007/978-3-642-17164-2_21
- Ralf Jung. 2018. Two Kinds of Invariants: Safety and Validity. https://www.ralfj.de/blog/2018/08/22/two-kinds-of-invariants.html Accessed: June 19th 2023.
- Stacked borrows: an aliasing model for Rust. Proceedings of the ACM on Programming Languages 4, POPL (Dec. 2019), 41:1–41:32. https://doi.org/10.1145/3371109
- RustBelt: securing the foundations of the Rust programming language. Proceedings of the ACM on Programming Languages 2, POPL (Dec. 2017), 66:1–66:34. https://doi.org/10.1145/3158154
- Iris from the ground up: A modular foundation for higher-order concurrent separation logic. Journal of Functional Programming 28 (2018), e20. https://doi.org/10.1017/S0956796818000151
- The future is ours: prophecy variables in separation logic. Proceedings of the ACM on Programming Languages 4, POPL (Dec. 2019), 45:1–45:32. https://doi.org/10.1145/3371113
- Ralf Jung and Neven Villani. 2023. From Stacks to Trees: A new aliasing model for Rust. https://www.ralfj.de/blog/2023/06/02/tree-borrows.html Accessed: Nov. 16 2019.
- Verus: Verifying Rust Programs using Linear Ghost Types. Proceedings of the ACM on Programming Languages 7, OOPSLA1 (April 2023), 85:286–85:315. https://doi.org/10.1145/3586037
- Flux: Liquid Types for Rust. https://doi.org/10.48550/arXiv.2207.04034 arXiv:2207.04034 [cs].
- The CompCert Memory Model, Version 2. report. INRIA. https://hal.inria.fr/hal-00703441 Pages: 26.
- Daniël Louwrink. 2021. A Separation Logic for Stacked Borrows. Report. https://eprints.illc.uva.nl/id/eprint/1790/
- Gillian, Part II: Real-World Verification for JavaScript and C. In Computer Aided Verification (Lecture Notes in Computer Science), Alexandra Silva and K. Rustan M. Leino (Eds.). Springer International Publishing, Cham, 827–850. https://doi.org/10.1007/978-3-030-81688-9_38
- Nicholas D. Matsakis and Felix S. Klock. 2014. The rust language. ACM SIGAda Ada Letters 34, 3 (Oct. 2014), 103–104. https://doi.org/10.1145/2692956.2663188
- RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code. In Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2022). Association for Computing Machinery, New York, NY, USA, 841–856. https://doi.org/10.1145/3519939.3523704
- RustHorn: CHC-based Verification for Rust Programs. ACM Transactions on Programming Languages and Systems 43, 4 (Oct. 2021), 15:1–15:54. https://doi.org/10.1145/3462205
- The Coq Team. 2023a. The Coq Proof Assistant. https://coq.inria.fr/ Accessed: Nov. 16th 2023.
- The Kani Team. 2023b. How Open Source Projects are Using Kani to Write Better Software in Rust | AWS Open Source Blog. https://aws.amazon.com/blogs/opensource/how-open-source-projects-are-using-kani-to-write-better-software-in-rust/ Accessed: Nov. 13th 2023.
- The Rust Team. 2023c. Rust Programming Language. https://www.rust-lang.org/ Accessed: Nov. 16th 2023.