paperbot · PL 论文追踪

全部论文 待读 收藏

P0 LLM Assistance for Memory Safety

LLM 辅助的内存安全
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 8/10 · 论文属于“AI→PL”方向,用 LLM 结合轻量静态分析完成 C 到 CheckedC 的注解推断与代码重构,契合 LLM 改进程序分析与形式化验证工具链的核心兴趣;同时有工具实现、真实代码评估和与符号方法的对比。但它不涉及浮点程序分析、贝叶斯程序分析或 Agentic 程序,因此不是最核心的 10 分匹配。引用 5 inbox
Nausheen Mohammed, Akash Lal, Aseem Rastogi, Rahul Sharma, Subhajit Roy
crossref: 2026-09-12

AI 速览

一句话:提出 MSA 框架,用 LLM 结合轻量静态分析将 C 代码移植到 CheckedC,自动推断注解并重构代码。

C 等底层语言中的内存安全违规仍是软件漏洞的主要来源。通过将 C 代码移植到安全的 C 方言可从构造上消除此类违规,但该过程需要程序员手动推断注解并可能重构代码,负担沉重,因而采用有限。本文利用大语言模型(LLM)同时应对注解推断与代码重写两个问题,挖掘 LLM 进行复杂代码推理和大规模代码库重写的能力,并提出一种新颖的整体程序变换框架:借助轻量静态分析将变换分解为更小的步骤,使 LLM 能够有效完成。作者实现了面向 CheckedC 方言的工具 MSA,并在多个微基准以及高达 2 万行的真实代码上评估。结果表明,MSA 优于朴素 LLM 基线,并且相比最先进的符号(非 LLM)技术也有提升。

问题
底层语言(如 C)中的内存安全违规是软件漏洞的主要来源;将其移植到安全 C 方言可从根本上消除违规,但人工推断注解与重构代码负担过重,导致该技术采用有限。
方法
利用 LLM 进行复杂代码推理与大规模代码重写,并提出整体程序变换框架,用轻量静态分析把变换拆解为 LLM 能有效执行的小步骤;实现面向 CheckedC 的工具 MSA。
评估
在多个微基准和高达 2 万行的真实代码上评估 MSA,与朴素 LLM 基线及最先进的符号(非 LLM)技术对比,展示出更优性能。
原文摘要(Abstract)

Memory safety violations in low-level code, written in languages like C, continues to remain one of the major sources of software vulnerabilities. One method of removing such violations by construction is to port C code to a safe C dialect. Such dialects rely on programmer-supplied annotations to guarantee safety with minimal runtime overhead. This porting, however, is a manual process that imposes significant burden on the programmer and, hence, there has been limited adoption of this technique. The task of porting not only requires inferring annotations, but may also need refactoring/rewriting of the code to make it amenable to such annotations. In this paper, we use Large Language Models (LLMs) towards addressing both these concerns. We show how to harness LLM capabilities to do complex code reasoning as well as rewriting of large codebases. We also present a novel framework for whole-program transformations that leverages lightweight static analysis to break the transformation into smaller steps that can be carried out effectively by an LLM. We implement our ideas in a tool called MSA that targets the CheckedC dialect. We evaluate MSA on several micro-benchmarks, as well as real-world code ranging up to 20K lines of code. We showcase superior performance compared to a vanilla LLM baseline, as well as demonstrate improvement over a state-of-the-art symbolic (non-LLM) technique.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8794,
  title = {LLM Assistance for Memory Safety},
  author = {Nausheen Mohammed and Akash Lal and Aseem Rastogi and Rahul Sharma and Subhajit Roy},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00023}
}