Beyond Memory Safety: an Empirical Study on Bugs and Fixes of Rust Programs

Rust is a nascent programming language designed to improve memory safety for system programming while maintaining high performance. The Rust language ensures memory safety through its ownership mechanism and by performing compile-time checks on safe code. However, for low-level controls, developers...

Full description

Saved in:
Bibliographic Details
Published in2024 IEEE 24th International Conference on Software Quality, Reliability and Security (QRS) pp. 272 - 283
Main Authors Zhang, Chengquan, Feng, Yang, Zhang, Yaokun, Dai, Yuxuan, Xu, Baowen
Format Conference Proceeding
LanguageEnglish
Published IEEE 01.07.2024
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:Rust is a nascent programming language designed to improve memory safety for system programming while maintaining high performance. The Rust language ensures memory safety through its ownership mechanism and by performing compile-time checks on safe code. However, for low-level controls, developers are allowed to bypass these checks by marking their code as unsafe, which in turn introduces memory vulnerabilities. Beyond these memory-related concerns, the existence and nature of other common bugs such as run-time panics have not been thoroughly explored. In this paper, we conduct a comprehensive empirical study to characterize bugs and their fixes beyond memory safety concerns by manually inspecting bug patches in Rust programs. We identify 790 bug fixes from 1100 commits in six widely-used Rust projects and the Rust standard library, and then investigate their root causes and symptoms. Furthermore, we analyze the relationships between these bugs and unsafe code (i.e., whether they are caused by the use of unsafe code and to what extent it impacts them). Our bug study introduces a classification of 15 root causes and 6 symptoms, and categorizes bugs into different groups according to their relationships with safe/unsafe code. We identify 19 major findings and draw broader lessons from them to guide the research community towards future directions in program testing, analysis, fault localization, and repair for Rust language.
ISSN:2693-9177
DOI:10.1109/QRS62785.2024.00035