Thetis: A Booster for Building Safer Systems Using the Rust Programming Language
-
Published:2023-11-28
Issue:23
Volume:13
Page:12738
-
ISSN:2076-3417
-
Container-title:Applied Sciences
-
language:en
-
Short-container-title:Applied Sciences
Author:
Jiang Renshuang1, Dong Pan1, Ding Yan1, Wei Ran2, Jiang Zhe3
Affiliation:
1. College of Computer Science and Technology, National University of Defense Technology, Changsha 410073, China 2. Department of Engineering, University of Cambridge, Cambridge CB2 1PZ, UK 3. Department of Computer Science and Technology, University of Cambridge, Cambridge CB3 0FD, UK
Abstract
Rust is a new system-level programming language that prioritizes performance, safety, and productivity. However, as evidenced in many previous works, unsafe code fragments broadly exist in Rust projects. The use of these unsafe fragments can fundamentally violate the safety of systems developed using the programming language. In response to this problem, we propose a novel methodology (Thetis) to enhance the safety capability of Rust. The core idea of Thetis is to reduce unsafe code, encapsulate unsafe code using safety rules, and make it easier to verify unsafe code through formal means. The proposed methodology involves three main components. In the context of Rust itself, Thetis combines replacement and encapsulation for Interior Unsafe segments, minimizing unsafe fragments and reducing unsafe operations and their range. For systems developed using Rust, new ACSL formal statutes are applied to reduce the unsafe potential of the encapsulated Interior Unsafe segments, enhancing the safety of the system. Regarding the development life cycle in Rust, Thetis introduces automatic defect detection and optimization based on feature extraction, improving engineering efficiency. We demonstrate the effectiveness of Thetis by using it to fix defects in BlogOS and ArceOS. The experimental results reveal that Thetis reduces the number of unsafe operations in these OSs by 40% and 45%, respectively. The use of Miri to detect and eliminate defects in ArceOS reduces the likelihood of undefined behavior by about 50%, which effectively demonstrates that the proposed method can improve the safety of the Rust system. In addition, performance test results from LMbench show that the performance loss caused by Thetis is only 1.076%, thereby maintaining the high-performance characteristics of the Rust system.
Funder
National Natural Science Foundation of China Pre-Research Project
Subject
Fluid Flow and Transfer Processes,Computer Science Applications,Process Chemistry and Technology,General Engineering,Instrumentation,General Materials Science
Reference62 articles.
1. Gens, D., Schmitt, S., Davi, L., and Sadeghi, A.-R. (2018, January 18–21). K-Miner: Uncovering Memory Corruption in Linux. Proceedings of the 25th Annual Network and Distributed System Security Symposium, NDSS 2018, San Diego, CA, USA. 2. Research Situation and Prospects of Operating System Virtualization;Wu;J. Comput. Res. Dev.,2019 3. (2019, May 30). Concurrency in Operating System. Available online: https://www.geeksforgeeks.org/concurrency-in-operating-system/. 4. (2023, November 13). Memory Management. Available online: https://www.tutorialspoint.com/operating_system/os_memory_management.htm. 5. Nagarakatte, S.G. (2012). Practical Low-Overhead Enforcement of Memory Safety for C Programs, University of Pennsylvania.
|
|