Improving automated C-to-Rust translation

DegreeMaster
StatusActive
Supervisor(s)Univ.-Prof. Dr. Rainer Böhme

Description

Large parts of the world’s essential codebase is written in C, a programming language prone to security vulnerabilities due to its manual memory management and unchecked array access. Meanwhile, Rust offers compile-time guarantees for memory safety and concurrent execution with comparable performance, making it a suitable target for rewriting C programs. Although tools exist to translate C code into Rust, such as C2Rust, most of the output is not idiomatic and relies on the unsafe keyword in Rust. This means that Rust’s security guarantees cannot be proven, and manual refactoring is required to transform the unsafe parts into a safe program.

This thesis identifies and measures the prevalence of unsafe patterns in a sample of open-source programs translated with C2Rust. It also proposes and evaluates static analysis techniques that can automatically rewrite selected patterns in the C2Rust output into idiomatic, safe Rust code.

References

  • Emre, M., Schroeder, R., Dewey, K., and Hardekopf, B. Translating C to safer Rust. Proceedings of the ACM on Programming Languages, 5, OOPSLA (2021), 1–29.