arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.10298cs.CR
收藏

基于摘要的快速全程序分析以识别 Rust 中的不安全内存访问

Fast Summary-based Whole-program Analysis to Identify Unsafe Memory Accesses in Rust

Jie Zhou, Mingshen Sun, John Criswell

AI总结:

针对 Rust 不安全代码导致的内存安全问题,提出基于摘要的 MIR 全程序分析,按需计算信息以节省时间并利用高级类型信息提高精度,原型验证了识别不安全堆分配与访问的有效性。

摘要:

Rust 是最有希望从根本上解决困扰底层软件四十多年的内存安全问题的系统编程语言之一。然而,为了适应 Rust 的类型规则可能对某些系统编程过于严格以及程序员选择性能而非安全检查的场景,Rust 提供了安全逃逸通道,允许编写不安全的源代码或调用不安全的库。因此,不安全的 Rust 代码和直接链接的不安全外部库不仅可能自身引入内存安全违规,而且由于它们与安全的 Rust 运行在相同的单片地址空间中,还可能危及整个程序。\n 这个问题可以通过隔离不安全内存对象(那些被不安全代码访问的对象)并对不安全内存的访问进行沙箱化来缓解。先前的一类工作利用 LLVM IR 上现有的程序分析框架来识别不安全的内存对象和访问。然而,它们存在分析时间长和精度低的局限性。在本文中,我们通过基于摘要的 Rust MIR 全程序分析解决了这两个挑战。基于摘要的分析按需计算信息以节省分析时间。在 Rust 的 MIR 上执行分析利用了 Rust 固有的丰富高级类型信息,而这些信息在 LLVM IR 中不可用。本手稿是对正在进行的研究的初步研究。我们原型实现了一个全程序分析,用于识别不安全的堆分配和对这些不安全堆对象的内存访问。我们在本文中报告了该分析的开销和有效性。

英文摘要:

Rust is one of the most promising systems programming languages to fundamentally solve the memory safety issues that have plagued low-level software for over forty years. However, to accommodate the scenarios where Rust's type rules might be too restrictive for certain systems programming and where programmers opt for performance over security checks, Rust opens security escape hatches allowing writing unsafe source code or calling unsafe libraries. Consequently, unsafe Rust code and directly-linked unsafe foreign libraries may not only introduce memory safety violations themselves but also compromise the entire program as they run in the same monolithic address space as the safe Rust. This problem can be mitigated by isolating unsafe memory objects (those accessed by unsafe code) and sandboxing memory accesses to the unsafe memory. One category of prior work utilizes existing program analysis frameworks on LLVM IR to identify unsafe memory objects and accesses. However, they suffer the limitations of prolonged analysis time and low precision. In this paper, we tackled these two challenges using summary-based whole-program analysis on Rust's MIR. The summary-based analysis computes information on demand so as to save analysis time. Performing analysis on Rust's MIR exploits the rich high-level type information inherent to Rust, which is unavailable in LLVM IR. This manuscript is a preliminary study of ongoing research. We have prototyped a whole-program analysis for identifying both unsafe heap allocations and memory accesses to those unsafe heap objects. We reported the overhead and the efficacy of the analysis in this paper.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑