Work

C vs Rust: Manual vs Automatic Spatial and Temporal Memory Safety

Year: 2025
Type: article
Abstract: The C programming language is commonly used for creating high-performance and low-level applications such as device drivers and operating systems due to its efficiency. However, despite its performance capabilities, C is known for its vulnerabilities and unsafe coding practices. Rust is presented as an alternative to C, with a focus on improved safety without compromising performance. Rust employs ownership and borrowing concepts to manage memory usage, ensuring that the memory cannot be manipulated freely without adhering to specific rules designed to prevent security attacks. The memory restrictions are implemented either at compile time or runtime without requiring the programmer's direct involvement; however, the programmer must adhere to a strict coding standard. In contrast, C programs can be secured by manually implementing similar restrictions on memory access and adding checks for unpredictable runtime behavior. While this approach offers some protection against attacks, it requires the developer to have detailed knowledge of memory management and programming best practices. This research focuses on evaluating memory safety issues in terms of spatial and temporal safety, comparing Rust's security mechanisms (or lack thereof) to C. Spatial safety involves securing vulnerable memory locations, while temporal safety ensures safe access to memory at different times. These concepts are frequently exploited by attackers to access data or inject attack payload. Our analysis demonstrates that Rust offers stronger guarantees for memory safety compared to manual security implementations in C. However, C remains a viable option for performance-critical applications, as it can still be secured through careful coding practices.
Language: English
Open Access status: gold
Estimated APC paid: $100
OpenAlex ID: W4409811091
FWCI: 0.427
Cites:
Cited by: 1
Related to: 10