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

迈向更好的Linux内核故障定位:利用对比推理和层次上下文分析

Towards Better Linux Kernel Fault Localization: Leveraging Contrastive Reasoning and Hierarchical Context Analysis

School of Computer Software, Tianjin University(天津大学计算机软件学院);School of Computer Science and Technology, Information and Network Center, Tianjin University(天津大学计算机科学与技术学院、信息网络中心);School of Cybersecurity, Tianjin University(天津大学网络安全学院);School of Computer Software, School of Artificial Intelligence, Tianjin University(天津大学计算机软件学院、人工智能学院)

Haichi Wang, Ruiguo Yu, Yesong Pang, Yingquan Zhao, Junjie Chen, Jiajun Jiang, Zan Wang

AI总结:

提出CoHiKer方法,通过对比推理分析测试用例行为差异,结合层次上下文分析从文件到方法逐级缩小定位范围,在Linux内核故障定位中Top-1准确率提升高达26.07%(文件级)和56.85%(方法级)。

摘要:

由于Linux内核代码库庞大、架构复杂且涉及底层编程细节,调试其故障仍然是一项艰巨的挑战。因此,有效的故障定位(FL)对于高效的内核调试和维护至关重要。现有的FL技术(包括传统方法和基于LLM的方法)在通用软件中表现出潜力,但在内核上下文中并不适用。特别是,最近的基于LLM的技术通常将错误报告和源代码视为纯文本,缺乏对内核特定知识的深度整合,这限制了它们识别根本原因和实现细粒度定位的能力。我们提出了CoHiKer,一种专为Linux内核量身定制的新型基于LLM的FL技术。CoHiKer引入了两项关键创新:(1)对比推理,通过分析经过精心变异的通过和失败测试用例之间的行为差异来识别根本原因;(2)层次上下文分析,通过整合崩溃报告、系统调用语义、文件间依赖关系和内核特定特征,系统地缩小定位范围从文件到方法。与依赖静态理解和全代码输入的先前技术不同,CoHiKer分解定位任务,并支持结构化LLM提示,以在有意义的上下文上进行语义推理。我们在一个扩展的Linux内核错误数据集上,针对五个最先进的基线评估了CoHiKer。CoHiKer始终优于所有竞争对手,在文件级和方法级上,Top-1定位准确率分别比最先进的基于LLM的基线提高了高达26.07%和56.85%,同时令牌消耗分别减少了高达8.84%和28.9%。此外,CoHiKer在非内核数据集上表现出强大的泛化能力,在文件级和方法级上Top-1分别获得了15.5%和5.3%的增益。

英文摘要:

Debugging the Linux kernel remains a formidable challenge due to its vast codebase, complex architecture, and low-level programming intricacies. Effective fault localization (FL) is thus essential for efficient kernel debugging and maintenance. While existing FL techniques (both traditional and LLM-based) have shown promise in general-purpose software, they are ill-suited for the kernel context. In particular, recent LLM-based techniques often treat bug reports and source code as plain text, lacking deep integration of kernel-specific knowledge, which limits their ability to identify root causes and achieve fine-grained localization. We present CoHiKer, a novel LLM-based FL technique tailored to the Linux kernel. CoHiKer introduces two key innovations: (1) contrastive reasoning, which identifies root causes by analyzing the behavioral divergence between carefully mutated passing and failing test cases, and (2) hierarchical context analysis, which systematically narrows the localization scope from files to methods by integrating crash reports, syscall semantics, inter-file dependencies, and kernel-specific features. Unlike prior techniques that rely on static understanding and full-code input, CoHiKer decomposes the localization task and enables structured LLM prompting to reason semantically over meaningful contexts. We evaluate CoHiKer on an extended Linux kernel bug dataset against five state-of-the-art baselines. CoHiKer consistently outperforms all competitors, improving Top-1 localization accuracy by up to 26.07% at the file level and 56.85% at the method level over state-of-the-art LLM-based baselines, while achieving up to 8.84% and 28.9% reductions in token consumption, respectively. Furthermore, CoHiKer demonstrates strong generalizability on the non-kernel dataset, with comparable gains (15.5% and 5.3% in Top-1 at file and method levels).

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

↑