一句话:提出 CoHiKer,用对比推理与层次化上下文分析显著提升 Linux 内核故障定位的文件级与方法级精度并降低 token 开销。
Linux 内核代码库庞大、架构复杂且涉及底层细节,现有故障定位技术(含基于 LLM 的方法)多面向通用软件,并把缺陷报告与源码当作纯文本,缺乏内核领域知识,难以定位根因与细粒度位置。本文提出 CoHiKer:(1) 对比推理,通过分析变异后的通过/失败测试用例之间的行为差异识别根因;(2) 层次化上下文分析,融合崩溃报告、系统调用语义、文件间依赖与内核特有特征,把定位范围从文件逐步缩小到方法,并以结构化提示让 LLM 在语义化上下文中推理。在扩展的 Linux 内核缺陷数据集上对比五个 SOTA 基线,文件级与方法级 Top-1 准确率分别最高提升 26.07% 与 56.85%,token 消耗最多降低 8.84× 与 28.9×;在非内核数据集上也展现泛化收益。
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). These results demonstrate the promise of CoHiKer as a practical and accurate solution for kernel FL.
@inproceedings{abs-2607-00562,
title = {Towards Better Linux Kernel Fault Localization: Leveraging Contrastive Reasoning and Hierarchical Context Analysis},
author = {Haichi Wang and Ruiguo Yu and Yesong Pang and Yingquan Zhao and Junjie Chen and Jiajun Jiang and Zan Wang},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3787792}
}