Characterizing Unsafe Code Encapsulation In Real-world Rust Systems
Zihao Rao, Yiran Yang, Hui Xu

TL;DR
This paper analyzes how unsafe code is encapsulated in real-world Rust systems, proposing a novel graph-based model to improve safety auditing and identify common issues affecting soundness.
Contribution
It introduces an unsafety isolation graph and structural patterns to model and analyze unsafe code encapsulation in Rust, aiding safety verification.
Findings
Effective characterization of unsafe code encapsulation in Rust projects
Identification of two common issues affecting soundness verification
Proposed approach applicable to real-world Rust systems
Abstract
Interior unsafe is an essential design paradigm advocated by the Rust community in system software development. However, there is little official guidance or few best practices regarding how to encapsulate unsafe code and achieve interior unsafe. The problem is critical because the Rust compiler is incapable of verifying the soundness of a safe function containing unsafe code. Falsely declaring an interior unsafe function as safe may undermine the fundamental memory-safety guarantee of Rust. To address this issue, this paper studies how interior unsafe is achieved in practice, aiming to identify best practices to guide Rust code design concerning unsafe code encapsulation. Specifically, we propose a novel unsafety isolation graph to model the essential usage and encapsulation of unsafe code. Based on the graph, we further propose four major isolation types and nine structural patterns…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsReal-time simulation and control systems · Smart Grid Security and Resilience · Advanced Manufacturing and Logistics Optimization
