arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.19239cs.PLcs.SE
收藏

用LLM生成的鬼代码解构符号执行中的逻辑炸弹

Defusing Logic Bombs in Symbolic Execution with LLM-Generated Ghost Code

Key Lab of HCST (PKU), MoE, SCS, Peking University(北京大学信息科学技术学院,复杂系统管理与控制国家重点实验室)

Dimitrios Stamatios Bouras, Sergey Mechtaev

AI总结:

本文提出Gordian框架,通过LLM生成轻量级鬼代码辅助SMT求解器处理对抗性代码,提升覆盖率和效率,减少LLM使用量。

摘要:

符号执行是一种强大的程序分析技术,但其效果受到求解器敌对的程序片段、复杂的数值推理和无界堆结构的限制。最近的研究尝试用大型语言模型(LLM)替代约束求解器以克服这些限制,但此类方法在分析现实世界代码库时面临挑战,因为深层执行路径需要在众多相互作用的约束中进行全局一致的推理。我们提出了Gordian,一种混合的符号执行框架,通过选择性地使用LLM生成轻量级鬼代码,帮助SMT求解器处理求解器敌对的代码片段,同时保留其精确的全局推理能力。具体而言,我们提出了三种类型的鬼代码:(1)通过迭代双向约束传播来反转困难的代码片段;(2)通过求解器友好的替代物建模,同时保留相关行为;(3)对无界堆空间进行语义划分。我们将在KLEE符号执行引擎上实现Gordian,并在合成的'逻辑炸弹'、流行的数学库FDLibM以及三个结构化输入程序(libexpat、jq和bc)上进行评估。在所有基准测试中,Gordian在传统符号执行基线上的覆盖率平均提高52-84%,在LLM方法上提高86-419%,同时减少LLM令牌使用量平均90-96%。这突显了该方法在现实世界中的实用性和有效性。

英文摘要:

Symbolic execution is a powerful program analysis technique, but its effectiveness is fundamentally limited by solver-hostile program fragments, complex numerical reasoning, and unbounded heap structures. Recent work proposed replacing constraint solvers with large language models (LLMs) to bypass these limitations, but such approaches struggle to analyze real-world codebases, where deep execution paths require globally consistent reasoning across many interacting constraints. We present Gordian, a hybrid symbolic execution framework that uses LLMs selectively to generate lightweight ghost code that aids an SMT solver in handling solver-hostile code fragments, while preserving its precise, global reasoning capability. In particular, we propose three types of ghost code: (1) inversion of difficult code fragments with iterative bidirectional constraint propagation, (2) modeling via solver-friendly surrogates while preserving relevant behavior, and (3) semantic partitioning of unbounded heap spaces. We implemented Gordian on top of the KLEE symbolic execution engine and evaluated it on synthetic "logic bombs" capturing distinct symbolic reasoning challenges, a popular mathematical library FDLibM, and four structured-input programs (libexpat, jq, bc and libyaml). Across benchmarks, Gordian improves coverage by 28.5-115.2% over traditional symbolic execution baseline and by 74.1-189.8% over LLM-based symbolic execution baselines, while reducing LLM token usage by an average of 91-96%. This highlights the practicality and effectiveness of this approach in real-world settings.

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

↑