paperbot · PL 论文追踪

全部论文 待读 收藏

P1 RustAssure: Differential Symbolic Testing for LLM-Transpiled C-to-Rust Code

RustAssure:面向 LLM 转译 C-to-Rust 代码的差分符号测试
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 5/10 · 论文将 LLM 用于 C-to-Rust 转译,并用差分符号测试验证语义等价,处于 LLM 与程序验证的交叉点;但它并非研究所关注的在 ML/Agent 程序中做静态分析,也不是用 LLM 改进静态分析或形式化验证,因此属于中等相关。引用 1 inbox
Yubo Bai, Tapti Palit
crossref: 2026-09-12

AI 速览

一句话:用 LLM 将 C 代码转译为 Rust,并通过差分符号测试验证转译结果与原代码的语义等价性。

将 C 等不安全内存语言的既有代码库转译为 Rust 是获得内存安全保证的前提,但仅靠传统单元测试或模糊测试难以发现 LLM 自动转译所产生的细微语义错误。RustAssure 提出一套基于大语言模型的自动 C-to-Rust 转译系统:一方面通过提示工程(prompt engineering)引导 LLM 生成惯用且安全的 Rust 代码,另一方面在原始 C 函数与转译后的 Rust 函数之间执行差分符号测试,以建立两者的语义相似性,从而捕捉传统测试遗漏的语义偏差。作者在五个真实应用与库上评估该系统,结果显示其能为 89.8% 的 C 函数生成可编译的 Rust 函数,其中 72% 的函数在符号返回值上与原 C 函数等价。

问题
C 等不安全内存语言的代码库必须先转译为 Rust 才能享受内存安全保证,而 LLM 自动转译容易引入传统单元测试或模糊测试难以发现的细微语义错误。
方法
采用提示工程让 LLM 生成惯用且安全的 Rust,并通过差分符号测试比较原 C 函数与转译 Rust 函数的符号返回值,以判定语义相似性。
评估
在五个真实应用与库上评估,89.8% 的 C 函数生成了可编译的 Rust 函数,其中 72% 在 C 与 Rust 之间产生了等价的符号返回值。
原文摘要(Abstract)

Rust is a memory-safe programming language that significantly improves software security. Existing codebases written in unsafe memory languages, such as C, must first be transpiled to Rust to take advantage of Rust’s improved safety guarantees. RustAssure presents a system that uses Large Language Models (LLMs) to automatically transpile existing C code-bases to Rust. RustAssure uses prompt engineering techniques to maximize the chances of the LLM generating idiomatic and safe Rust code. Moreover, because LLMs often generate code with subtle bugs that can be missed under traditional unit or fuzz testing, RustAssure performs differential symbolic testing to establish the semantic similarity between the original C and LLM-transpiled Rust code. We evaluated RustAssure with five real-world applications and libraries, and showed that our system is able to generate compilable Rust functions for 89.8% of all C functions, of which 72% produced equivalent symbolic return values for both the C and Rust functions.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9561,
  title = {RustAssure: Differential Symbolic Testing for LLM-Transpiled C-to-Rust Code},
  author = {Yubo Bai and Tapti Palit},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00051}
}