Gaurav
Vermani
SURF C to Rust: Manual Conversion Methods and Standardized Dataset Creation Innovative Technology / Entrepreneurship / Design
Abstract profile. Full document pending author claim.
Authors:
Gaurav Vermani
Date Created:
Not specified
Course Title:
Professor:
Not specified
About Paper:
The strongly and statically typed programming language, Rust, focuses on memory safety and low-level control, as well as incorporating features from functional programming languages. Due to its unique combination of features, it is seen as a safer yet flexible alternative to C, fueling an interest in migrating legacy codebases from C to Rust. This demand has led to the development of C-to-Rust transpilers, such as the C2Rust project, that attempt to convert C syntax to Rust while maintaining the source code semantics. However, such existing tools have an inadvertent drawback: they preserve certain unsafe practices of C, denoting them with the "unsafe" keyword to circumvent the Rust compiler's safety checks, potentially compromising the language's memory-safety guarantees. This research explores methods and standardized patterns for translating C code into safe and idiomatic Rust. Firstly, we manually create mappings for common C code patterns to their safe Rust equivalents. Next, these patterns are used to convert a diverse dataset of C code into line-by-line corresponding Rust code, thereby generating a standardized C-to-Rust codebase. This dataset currently includes programs spanning various categories from data structures and algorithms; and will incorporate vulnerable test cases from the Juliet Test Suite, and pointer-intensive benchmarks from Ptrdist in the future. Future work will also utilize this dataset as a benchmark for establishing metrics to assess current transpilers and for developing an automated transpiler. Keywords: C; Rust
Source:
Purdue University / 2024
Topics:
No topics listed
Co-authors:
Gaurav Vermani