Understanding memory and thread safety practices and issues in real-world Rust programs

Boqin Qin, Yilun Chen, Zeming Yu, Linhai Song, Yiying Zhang

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Rust is a young programming language designed for systems software development. It aims to provide safety guarantees like high-level languages and performance efficiency like low-level languages. The core design of Rust is a set of strict safety rules enforced by compile-time checking. To support more low-level controls, Rust allows programmers to bypass these compiler checks to write unsafe code. It is important to understand what safety issues exist in real Rust programs and how Rust safety mechanisms impact programming practices. We performed the first empirical study of Rust by close, manual inspection of 850 unsafe code usages and 170 bugs in five open-source Rust projects, five widely-used Rust libraries, two online security databases, and the Rust standard library. Our study answers three important questions: how and why do programmers write unsafe code, what memory-safety issues real Rust programs have, and what concurrency bugs Rust programmers make. Our study reveals interesting real-world Rust program behaviors and new issues Rust programmers make. Based on our study results, we propose several directions of building Rust bug detectors and built two static bug detectors, both of which revealed previously unknown bugs.

Original languageEnglish (US)
Title of host publicationPLDI 2020 - Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation
EditorsAlastair F. Donaldson, Emina Torlak
PublisherAssociation for Computing Machinery
Pages763-779
Number of pages17
ISBN (Electronic)9781450376136
DOIs
StatePublished - Jun 11 2020
Event41st ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2020 - London, United Kingdom
Duration: Jun 15 2020Jun 20 2020

Publication series

NameProceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)

Conference

Conference41st ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2020
CountryUnited Kingdom
CityLondon
Period6/15/206/20/20

All Science Journal Classification (ASJC) codes

  • Software

Fingerprint Dive into the research topics of 'Understanding memory and thread safety practices and issues in real-world Rust programs'. Together they form a unique fingerprint.

  • Cite this

    Qin, B., Chen, Y., Yu, Z., Song, L., & Zhang, Y. (2020). Understanding memory and thread safety practices and issues in real-world Rust programs. In A. F. Donaldson, & E. Torlak (Eds.), PLDI 2020 - Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (pp. 763-779). (Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)). Association for Computing Machinery. https://doi.org/10.1145/3385412.3386036