paperbot · PL 论文追踪

全部论文 待读 收藏

P2 C to checked C by 3c

通过 3C 将 C 转换为 Checked C
OOPSLA 6(OOPSLA1)2022匹配度 2/10 · 论文是传统静态分析工具,面向遗留 C 程序到 Checked C 的指针类型与数组边界注解推断,属于程序分析与安全方向,但未涉及用户核心关注的 PL 与 AI/LLM 交叉、浮点程序分析或贝叶斯程序分析。其问题场景与研究方向匹配度较低。引用 19 inbox
Aravind Machiry, John Kastner, Matt McCutchen, Aaron Eline, Kyle Headley, Michael Hicks
crossref: 2026-09-10

AI 速览

一句话:提出基于静态分析的半自动移植工具 3C,为遗留 C 程序推断 Checked C 检查指针类型与数组边界注解。

针对 C/C++ 中缓冲区溢出等空间安全违规,Checked C 以带边界检查的 checked 指针类型实现渐进式空间安全,兼容遗留指针并支持增量改造,但遗留程序移植仍需大量人工。本文提出以 3C 为核心的半自动移植流程:3C 是基于静态分析的注解工具,利用 typ3c 和 boun3c 两种新算法将遗留指针推断为 checked 指针,并为所需指针推断数组边界注解;它还进行根因分析,引导开发者重构代码,之后可重跑以推断更多注解。在 11 个共 319KLoC 的程序上,3C 能有效推断 checked 指针类型;结合人工重构的移植经验表明其效果良好。

问题
C/C++ 中缓冲区溢出等空间安全违规危害严重。Checked C 提供渐进式空间安全,但遗留代码移植到 Checked C 需要大量人工标注。
方法
本文提出基于静态分析注解工具 3C 的半自动移植流程,其中 typ3c 推断 checked 指针类型,boun3c 推断数组边界注解,并通过根因分析指导人工重构。
评估
在 11 个共 319KLoC 的程序上评估 3C 的注解推断效果,并结合已有及新移植代码的经验验证其与人工重构协作的有效性。
原文摘要(Abstract)

Owing to the continued use of C (and C++), spatial safety violations (e.g., buffer overflows) still constitute one of today's most dangerous and prevalent security vulnerabilities. To combat these violations, Checked C extends C with bounds-enforced checked pointer types. Checked C is essentially a gradually typed spatially safe C - checked pointers are backwards-binary compatible with legacy pointers, and the language allows them to be added piecemeal, rather than necessarily all at once, so that safety retrofitting can be incremental. This paper presents a semi-automated process for porting a legacy C program to Checked C. The process centers on 3C, a static analysis-based annotation tool. 3C employs two novel static analysis algorithms - typ3c and boun3c - to annotate legacy pointers as checked pointers, and to infer array bounds annotations for pointers that need them. 3C performs a root cause analysis to direct a human developer to code that should be refactored; once done, 3C can be re-run to infer further annotations (and updated root causes). Experiments on 11 programs totaling 319KLoC show 3C to be effective at inferring checked pointer types, and experience with previously and newly ported code finds 3C works well when combined with human-driven refactoring.

链接与引用

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

BibTeX
@article{paperbot1534,
  title = {C to checked C by 3c},
  author = {Aravind Machiry and John Kastner and Matt McCutchen and Aaron Eline and Kyle Headley and Michael Hicks},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA1},
  year = {2022},
  doi = {10.1145/3527322}
}