Jul 8, 2017 • Research, RustPermalink

RustBelt: Securing the Foundations of the Rust Programming Language

Just yesterday, we submitted our paper RustBelt: Securing the Foundations of the Rust Programming Language. Quoting from the abstract:

Rust is a new systems programming language that promises to overcome the seemingly fundamental tradeoff between high-level safety guarantees and low-level control over resource management. Unfortunately, none of Rust’s safety claims have been formally proven, and there is good reason to question whether they actually hold. Specifically, Rust employs a strong, ownership-based type system, but then extends the expressive power of this core type system through libraries that internally use unsafe features. In this paper, we give the first formal (and machine-checked) safety proof for a language representing a realistic subset of Rust. Our proof is extensible in the sense that, for each new Rust library that uses unsafe features, we can say what verification condition it must satisfy in order for it to be deemed a safe extension to the language. We have carried out this verification for some of the most important libraries that are used throughout the Rust ecosystem.

This paper is the result of almost two years of work by the RustBelt research project to formalize Rust’s type system. The paper is now undergoing peer review; some time in fall we will be notified whether the paper got accepted or not.

In case you wondered which “important libraries” we verified, the full list is Rc, Arc, Cell (including alias::one, which was recently accepted into the standard library), RefCell, Mutex, RwLock, thread::spawn, mem::swap, take_mut::take as well as converting &&T into &Box<T> (inspired by Abomonation). Our model of Rust is somewhat simplified (e.g., we don’t support unwinding after panics); still, we were actually able to find a real bug. For all the details, have a look at the paper. If that’s not enough details for your taste, you can also check out all our formal proofs.

Of course, I am far from the only person who worked on this. All these results were only possible because of my great collaborators, Jacques-Henri Jourdan and Robbert Krebbers, as well as my PhD advisor, Derek Dreyer. I also benefited a lot from countless discussions with the Rust community at large, and with Aaron and Niko in particular. You guys rock!

Posted on Ralf's Ramblings on Jul 8, 2017.
Comments? Drop me a mail or leave a note in the forum!