论文标题
生锈是由软件开发人员安全地使用的吗?
Is Rust Used Safely by Software Developers?
论文作者
论文摘要
Rust是一种具有爆炸性增长的新兴编程语言,它提供了一个可靠的类型系统,使程序员能够编写内存安全和数据竞赛免费代码。为了允许访问机器的硬件并支持低级性能优化,第二语言(不安全的生锈)嵌入了Rust中。它包含对难以静态检查的操作的支持,例如用于访问任意内存位置和可变的全局变量的C风格指针。当程序使用这些功能时,编译器将无法静态保证安全性生锈。在这项工作中,我们进行了一项大规模的经验研究,以探索软件开发人员如何在现实世界的生锈库和应用中使用不安全的生锈。我们的结果表明,软件工程师在不到30%的Rust库中使用了不安全的关键字,但是由于不安全的Rust隐藏在库的呼叫链中的某个地方,因此Rust编译器无法完全静态检查一半以上。我们得出的结论是,尽管使用不安全的关键字的使用是有限的,但不安全的传播给出了生锈作为记忆安全语言的挑战。此外,我们建议对Rust编译器和中央生锈库的界面进行更改,以帮助Rust Software开发人员知道何时不安全的生锈代码。
Rust, an emerging programming language with explosive growth, provides a robust type system that enables programmers to write memory-safe and data-race free code. To allow access to a machine's hardware and to support low-level performance optimizations, a second language, Unsafe Rust, is embedded in Rust. It contains support for operations that are difficult to statically check, such as C-style pointers for access to arbitrary memory locations and mutable global variables. When a program uses these features, the compiler is unable to statically guarantee the safety properties Rust promotes. In this work, we perform a large-scale empirical study to explore how software developers are using Unsafe Rust in real-world Rust libraries and applications. Our results indicate that software engineers use the keyword unsafe in less than 30% of Rust libraries, but more than half cannot be entirely statically checked by the Rust compiler because of Unsafe Rust hidden somewhere in a library's call chain. We conclude that although the use of the keyword unsafe is limited, the propagation of unsafeness offers a challenge to the claim of Rust as a memory-safe language. Furthermore, we recommend changes to the Rust compiler and to the central Rust repository's interface to help Rust software developers be aware of when their Rust code is unsafe.