TY - GEN
T1 - rustc++
T2 - 18th European Workshop on Systems Security, EuroSec 2025, co-located with the European Conference on Computer Systems, EuroSys 2025
AU - Louka, Antonis
AU - Portokalidis, Georgios
AU - Athanasopoulos, Elias
N1 - Publisher Copyright:
© 2025 ACM.
PY - 2025/4/2
Y1 - 2025/4/2
N2 - Rust is a popular programming language with strong memory-safety guarantees, achieved through its ownership and borrowing model. Rust allows a programmer to escape memory safety using explicitly marked unsafe code in order to facilitate integration with existing C/C++ code. Such safe code is not immune to typical memory errors. To avoid such bugs researchers try to provide both static and dynamic analysis tools and incorporate C/C++ hardening techniques for unsafe Rust. However, such analysis is not always trivial as Rust uses multiple intermediate representations (IR), and when lowering a higher level IR to a lower level IR, all information that marks a specific block of code as unsafe is lost. Since the two worlds of Rust, safe and unsafe, are built on different assumptions many analysis tools and techniques can benefit from knowing where the safe context changes to unsafe and vice-versa. In this work, we present a modified Rust compiler (rustc++) that extends the capabilities of the Mid-level Intermediate Representation (MIR) to enable serialization and metadata enhancements. Our framework introduces MIR++, an enhanced MIR representation that embeds metadata identifying safe and unsafe instructions, enabling fine-grained safety tracking throughout the compilation pipeline. Additionally, rustc++ enhances the LLVM-IR representation and produced binaries with metadata allowing LLVM passes and post-compilation analysis tools to distinguish between the safe and unsafe context. Lastly, rustc++ makes preliminary efforts in serializing Rusts MIR to a portable JSON format using the Serde serialization library. Our goal is to allow external tools to work on MIR and its in-memory metadata, without requiring the full compiler pipeline. Modifications of rustc++ maintain compatibility with the existing Rust ecosystem while offering a powerful foundation for future analysis tools.
AB - Rust is a popular programming language with strong memory-safety guarantees, achieved through its ownership and borrowing model. Rust allows a programmer to escape memory safety using explicitly marked unsafe code in order to facilitate integration with existing C/C++ code. Such safe code is not immune to typical memory errors. To avoid such bugs researchers try to provide both static and dynamic analysis tools and incorporate C/C++ hardening techniques for unsafe Rust. However, such analysis is not always trivial as Rust uses multiple intermediate representations (IR), and when lowering a higher level IR to a lower level IR, all information that marks a specific block of code as unsafe is lost. Since the two worlds of Rust, safe and unsafe, are built on different assumptions many analysis tools and techniques can benefit from knowing where the safe context changes to unsafe and vice-versa. In this work, we present a modified Rust compiler (rustc++) that extends the capabilities of the Mid-level Intermediate Representation (MIR) to enable serialization and metadata enhancements. Our framework introduces MIR++, an enhanced MIR representation that embeds metadata identifying safe and unsafe instructions, enabling fine-grained safety tracking throughout the compilation pipeline. Additionally, rustc++ enhances the LLVM-IR representation and produced binaries with metadata allowing LLVM passes and post-compilation analysis tools to distinguish between the safe and unsafe context. Lastly, rustc++ makes preliminary efforts in serializing Rusts MIR to a portable JSON format using the Serde serialization library. Our goal is to allow external tools to work on MIR and its in-memory metadata, without requiring the full compiler pipeline. Modifications of rustc++ maintain compatibility with the existing Rust ecosystem while offering a powerful foundation for future analysis tools.
KW - Borrow Checker
KW - MIR++
KW - Memory Safety
KW - Mixed Binaries
KW - Rust
KW - Rust Compiler Extensions
UR - http://www.scopus.com/inward/record.url?scp=105007284184&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=105007284184&partnerID=8YFLogxK
U2 - 10.1145/3722041.3723102
DO - 10.1145/3722041.3723102
M3 - Conference contribution
AN - SCOPUS:105007284184
T3 - Proceedings of the 18th European Workshop on Systems Security, EuroSec 2025, Part of EuroSys 2025
SP - 63
EP - 69
BT - Proceedings of the 18th European Workshop on Systems Security, EuroSec 2025, Part of EuroSys 2025
Y2 - 31 March 2025
ER -