arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2308.00245cs.SEcs.AI
收藏

程序分析的搭便车指南:大型语言模型之旅

The Hitchhiker's Guide to Program Analysis: A Journey with Large Language Models

UC Riverside(加州大学河滨分校)

Haonan Li, Yu Hao, Yizhuo Zhai, Zhiyun Qian

AI总结:

本文提出LLift框架,结合静态分析与大型语言模型,以使用前初始化错误为例,在真实场景中实现50%精度且无遗漏,并发现Linux内核13个新错误。

摘要:

静态分析是软件工程中广泛使用的识别和缓解错误的技术。然而,一个重大障碍在于实现精度与可扩展性之间的微妙平衡。大型语言模型(LLMs)提供了一种有前景的替代方案,因为最近的进展展示了其在理解、生成甚至调试代码方面的卓越能力。然而,错误的逻辑可能复杂,需要复杂的推理和跨越多个函数的大范围分析。因此,目前LLMs更适合作为辅助角色来补充静态分析。在本文中,我们深入探讨了LLM辅助静态分析的开放空间,以使用前初始化(UBI)错误作为案例研究。为此,我们开发了LLift,一个与静态分析工具和LLM交互的完全自动化框架。通过精心设计框架和提示,我们能够克服许多挑战,包括特定于错误的建模、大问题范围、LLMs的非确定性等。在真实场景中测试,分析静态分析产生的近千个潜在UBI错误,LLift展示了强大的能力,表现出合理的精度(50%)且似乎没有遗漏错误。它甚至在Linux内核中识别了13个以前未知的UBI错误。这项研究为在广泛真实世界数据集中使用LLMs进行错误发现开辟了新的机会和方法论。

英文摘要:

Static analysis is a widely used technique in software engineering for identifying and mitigating bugs. However, a significant hurdle lies in achieving a delicate balance between precision and scalability. Large Language Models (LLMs) offer a promising alternative, as recent advances demonstrate remarkable capabilities in comprehending, generating, and even debugging code. Yet, the logic of bugs can be complex and require sophisticated reasoning and a large analysis scope spanning multiple functions. Therefore, at this point, LLMs are better used in an assistive role to complement static analysis. In this paper, we take a deep dive into the open space of LLM-assisted static analysis, using use-before-initialization (UBI) bugs as a case study. To this end, we develop LLift, a fully automated framework that interfaces with both a static analysis tool and an LLM. By carefully designing the framework and the prompts, we are able to overcome a number of challenges, including bug-specific modeling, the large problem scope, the non-deterministic nature of LLMs, etc. Tested in a real-world scenario analyzing nearly a thousand potential UBI bugs produced by static analysis, LLift demonstrates a potent capability, showcasing a reasonable precision (50%) and appearing to have no missing bugs. It even identified 13 previously unknown UBI bugs in the Linux kernel. This research paves the way for new opportunities and methodologies in using LLMs for bug discovery in extensive, real-world datasets.

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

↑