paperbot · PL 论文追踪

全部论文 待读 收藏

P2 From Raw Pointers to Memory Safety: A Modular Demand-Driven Typestate Analysis for Rust

从裸指针到内存安全:面向 Rust 的模块化需求驱动类型状态分析
OOPSLA 10(OOPSLA1)2026匹配度 3/10 · 该论文属于纯静态程序分析(IFDS/类型状态分析),与用户关注的 PL 与 AI/LLM 交叉方向(如用 LLM 改进静态分析、分析 Agentic/ML 程序、浮点或贝叶斯程序分析)没有直接关联;仅在静态分析方法和数据流框架层面有一般性重叠。引用 0 inbox
Wei Li, Wenyao Chen, Jingling Xue
crossref: 2026-09-10

AI 速览

一句话:提出 Pincer:基于 IFDS 的模块化、需求驱动类型状态分析,精准检测 Rust unsafe 代码中的 use-after-free 与 double-free。

Rust 借助严格的所有权与借用规则实现内存安全,但其 unsafe 模式允许裸指针操作,重新引入内存安全漏洞。现有针对 Rust 的全程序分析往往召回率低、误报率高。考虑到 unsafe 代码通常规模小且局部化,作者提出需求驱动的替代方案 Pincer:一个构建于 IFDS 之上、流敏感、域敏感、上下文敏感的数据流分析框架。Pincer 执行双向分析——后向追踪裸指针来源、前向探索别名——并针对 Rust 的所有权模型与底层语义进行适配。在此之上,Pincer 实施模块化、自底向上、面向漏洞的类型状态分析,检测 use-after-free 与 double-free,跟踪裸指针别名与空值性,在容器操作返回处利用强更新,并借助 Rust 安全不变式通过 AXM 检查剪除可证明安全的区域。模块化设计使探索可控(可带预算),提升可扩展性;受控不健全性在保持高召回与高精度的同时进一步提高效率。作者在含漏洞程序与大型 Rust 项目上评估 Pincer,结果表明其比当前最先进的分析更准确地检测内存安全错误,同时保持实用效率。

问题
Rust 的 unsafe 模式允许裸指针操作,成为内存安全漏洞的主要来源;现有全程序分析对这类局部化 unsafe 代码召回率低、误报高。
方法
提出基于 IFDS 的需求驱动、流/域/上下文敏感数据流分析 Pincer,双向追踪裸指针来源与别名,并做模块化自底向上的类型状态分析,配合容器操作返回处的强更新、AXM 安全不变式剪枝以及可控不健全性与预算控制。
评估
在含漏洞的程序与大型 Rust 项目上进行评估,与最先进的分析工具比较检测内存安全错误的准确性与实际运行效率。
原文摘要(Abstract)

Rust combines high performance with strong memory safety through strict ownership and borrowing rules. However, its unsafe mode reintroduces vulnerabilities by allowing raw-pointer manipulation, a major source of memory-safety bugs. Existing whole-program analyses for Rust often suffer from low recall and high false positives. Since unsafe code is typically small and isolated, we propose a demand-driven alternative. We present Pincer , a flow-, field-, and context-sensitive dataflow analysis framework built on IFDS. Pincer performs mutually bidirectional analysis—backward to trace raw-pointer origins and forward to explore aliases—adapting this strategy to Rust’s ownership model and low-level semantics. On this foundation, Pincer performs a modular, bottom-up vulnerability-oriented typestate analysis to detect use-after-free and double-free bugs. It tracks raw-pointer aliasing and nullness, exploits strong updates at container-manipulating returns, and leverages Rust’s safety invariants to prune provably safe regions via AXM checking. The modular design enables controlled exploration, optionally under a budget, improving scalability. Controlled unsoundness further boosts efficiency while maintaining high recall and precision. We evaluate Pincer on vulnerable programs and large Rust projects. The results show that Pincer detects memory-safety errors more accurately than state-of-the-art analyses while maintaining practical efficiency.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot3818,
  title = {From Raw Pointers to Memory Safety: A Modular Demand-Driven Typestate Analysis for Rust},
  author = {Wei Li and Wenyao Chen and Jingling Xue},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA1},
  year = {2026},
  doi = {10.1145/3798266}
}