不安全是阿喀琉斯之踵吗?Unsafe Rust 编程中安全需求的综合研究
Is unsafe an Achilles' Heel? A Comprehensive Study of Safety Requirements in Unsafe Rust Programming
AI总结:
本文首次系统研究 Unsafe Rust 编程中的安全需求,通过定义 19 个安全属性并标注 416 个 unsafe API,结合 CVE 分类、crates.io 使用统计和用户调查,验证了安全需求描述统一化的必要性与实用性。
摘要:
Rust 是一种新兴的强类型编程语言,注重效率和内存安全。随着越来越多的项目采用 Rust,了解如何使用 Unsafe Rust 对 Rust 安全至关重要。我们观察到,在 Unsafe Rust 编程中,安全需求的描述需要统一。标准库中现有的 unsafe API 文档表现出差异,包括不一致和不充分。为了增强 Rust 安全性,我们建议 unsafe API 文档列出系统性的安全需求描述,供用户遵循。在本文中,我们首次对跨越 unsafe 边界的安全需求进行了全面的实证研究。我们研究了标准库中的 unsafe API 文档,并定义了 19 个安全属性(SP)。随后,我们对 416 个 unsafe API 完成了数据标注,同时分析它们之间的相关性以发现可解释的结果。为了验证实际可用性和 SP 覆盖范围,我们对截至 2023-07-08 的现有 Rust CVE 进行了分类,并对 crates.io 生态系统中 std unsafe API 的使用情况进行了统计分析。此外,我们还开展了一项用户调查,从经验丰富的 Rust 程序员那里获取四个方面的见解。我们最终收到了 50 份有效回复,并以统计显著性证实了我们的分类。
英文摘要:
Rust is an emerging, strongly-typed programming language focusing on efficiency and memory safety. With increasing projects adopting Rust, knowing how to use Unsafe Rust is crucial for Rust security. We observed that the description of safety requirements needs to be unified in Unsafe Rust programming. Current unsafe API documents in the standard library exhibited variations, including inconsistency and insufficiency. To enhance Rust security, we suggest unsafe API documents to list systematic descriptions of safety requirements for users to follow. In this paper, we conducted the first comprehensive empirical study on safety requirements across unsafe boundaries. We studied unsafe API documents in the standard library and defined 19 safety properties (SP). We then completed the data labeling on 416 unsafe APIs while analyzing their correlation to find interpretable results. To validate the practical usability and SP coverage, we categorized existing Rust CVEs until 2023-07-08 and performed a statistical analysis of std unsafe API usage toward the crates.io ecosystem. In addition, we conducted a user survey to gain insights into four aspects from experienced Rust programmers. We finally received 50 valid responses and confirmed our classification with statistical significance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。