Translating C to safer Rust
Open Access
- 15 October 2021
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 5 (OOPSLA), 1-29
- https://doi.org/10.1145/3485498
Abstract
Rust is a relatively new programming language that targets efficient and safe systems-level applications. It includes a sophisticated type system that allows for provable memory- and thread-safety, and is explicitly designed to take the place of unsafe languages such as C and C++ in the coding ecosystem. There is a large existing C and C++ codebase (many of which have been affected by bugs and security vulnerabilities due to unsafety) that would benefit from being rewritten in Rust to remove an entire class of potential bugs. However, porting these applications to Rust manually is a daunting task. In this paper we investigate the problem of automatically translating C programs into safer Rust programs--that is, Rust programs that improve on the safety guarantees of the original C programs. We conduct an in-depth study into the underlying causes of unsafety in translated programs and the relative impact of fixing each cause. We also describe a novel technique for automatically removing a particular cause of unsafety and evaluate its effectiveness and impact. This paper presents the first empirical study of unsafety in translated Rust programs (as opposed to programs originally written in Rust) and also the first technique for automatically removing causes of unsafety in translated Rust programs.This publication has 22 references indexed in Scilit:
- Rust as a language for high performance GC implementationPublished by Association for Computing Machinery (ACM) ,2016
- Ownership is theftPublished by Association for Computing Machinery (ACM) ,2015
- Cascade: A Universal Programmer-Assisted Type Qualifier Inference ToolPublished by Institute of Electrical and Electronics Engineers (IEEE) ,2015
- The Matter of HeartbleedPublished by Association for Computing Machinery (ACM) ,2014
- Propagation of JML non-null annotations in Java programsPublished by Association for Computing Machinery (ACM) ,2006
- Extended static checking for JavaPublished by Association for Computing Machinery (ACM) ,2002
- Ownership types for safe programmingPublished by Association for Computing Machinery (ACM) ,2002
- Houdini, an Annotation Assistant for ESC/JavaLecture Notes in Computer Science, 2001
- Annotation inference for modular checkersInformation Processing Letters, 2001
- Points-to analysis in almost linear timePublished by Association for Computing Machinery (ACM) ,1996