One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery
Qiushi Wu, Yue Xiao, Dhilung Kirat, Kevin Eykholt, Jiyong Jang, Douglas Schales
Abstract
Managing large programs and fixing bugs is a challenging task that demands substantial time and manual effort. In practice, when a bug is found, it is reported to the project maintainers, who work with the reporter to fix it. Once the bug is resolved, the issue is marked as closed. However, across the program, there are often similar code segments, which may also contain the bug, but were initially missed during discovery. Finding and fixing each recurring bug instance individually is labor intensive. Even more concerning, bug reports can inadvertently widen the attack surface as they provide attackers with an exploitable pattern that may be unresolved in other parts of the program. In this paper, we explore these Recurring Pattern Bugs (RPBs) that appear repeatedly across various code segments of a program or even in different programs, stemming from a same root cause, but are unresolved, even when a fix is available. Our investigation reveals that RPBs are not only prevalent, but also have the potential to significantly compromise the security of software programs. Various static analyzers exist for finding specific bug patterns but require significant engineering effort and don't generalize well beyond their predefined template. To tackle RPBs and enhance project maintenance efficiency, this paper introduces BUGSTONE, a program analysis system empowered by LLVM and a Large Language Model (LLM). The key observation is that many RPBs have a single instance patched, which can be leveraged to identify a consistent error pattern, such as a specific API misuse. By examining the entire program for other instances of this pattern, it is possible to identify similar sections of code that are vulnerable to the same type of bug. Starting with 135 unique seed RPBs, BUGSTONE was able to identify more than 22K new potential issues in the Linux kernel. Manual analysis of 400 of these findings confirmed that 246 are valid issues. These detected issues include invalid pointer dereferences, resource leaks, type errors, performance issues, and others, threatening the security and stability of the program. We also create a dataset from over 1.9K security bugs reported by 23 recent top-tier conference works targeting bug identification in the Linux kernel. We manually annotate the dataset, identify 80 recurring patterns and 850 corresponding fixes, and evaluate BUGSTONE on this dataset across six different LLMs and six prompt configurations. Even with a cost-efficient model choice, BUGSTONE achieved 92.2% precision and 79.1% pairwise accuracy, demonstrating its capability to accurately identify RPBs in real-world programs.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 33ae9b5f-bec9-4a97-85f3-162d02dbfd81Cited by top-tier papers1
Ask how each one uses itBuilds on44
- WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun et al.ICLR 2024 · 945 citations
- A Large-Scale Empirical Study of Security PatchesFrank Li, Vern PaxsonCCS 2017 · 273 citations
- Razzer: Finding Kernel Race Bugs through FuzzingDae R. Jeong, Kyungtae Kim, Basavesh Shivakumar, Byoungyoung Lee et al.S&P 2019 · 202 citations
- LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and BenchmarksSaad Ullah, Mingji Han, Saurabh Pujar, Hammond Pearce et al.S&P 2024 · 167 citations
- Enhancing Static Analysis for Practical Bug Detection: An LLM-Integrated ApproachHaonan Li, Yu Hao, Yizhuo Zhai, Zhiyun QianOOPSLA 2024 · 142 citations
Related papers
- Towards More Accurate Static Analysis for Taint-Style Bug Detection in Linux KernelHaonan Li, Hang Zhang, Kexin Pei, Zhiyun QianASE 2025 · 5 citations
- KNighter: Transforming Static Analysis with LLM-Synthesized CheckersChenyuan Yang, Zijie Zhao, Zichen Xie, Haoyu Li et al.SOSP 2025 · 1 citation
- Mining Long Tail Bugs: Identifying Rare and Overlooked Issues in CodeWentao Liang, Yanjun Wu, Xiang Ling, Tianyue Luo et al.FSE 2026
- Characterizing and Mitigating False-Positive Bug Reports in the Linux KernelJiashuo Tian, Dong Wang, Chen Yang, Haichi Wang et al.FSE 2026
- SpecAuditor: Generating Audit Specifications for LLM-Driven Bug DetectionMiaoqian Lin, Hao ChenS&P 2026 · 3 citations
