我们一定漏掉了这条注释:检测和修复 Linux 内核注释中的过时函数引用
We Must Have Missed This Comment: Detecting and Repairing Stale Function References in Linux Kernel Comments
浏览论文内容
中文总结 AI 辅助
针对 Linux 内核注释中因函数变更导致的过时引用问题,提出三阶段方法 ReCite 检测并修复此类引用,在 v6.18-rc1 上检测到 869 个过时引用,其修复建议准确率高,提交的 75 个补丁中有 50 个被接受。
中文摘要 AI 辅助
随着 Linux 内核的演进,代码注释可能会变得过时,因为它们引用的函数可能会被重构或删除,而注释却未相应更新。这类过时的函数引用会误导维护人员,从而阻碍代码理解。先前关于检测代码-注释不一致的工作主要集中在解决 Javadoc 注释与其直接标注函数之间的语义错位,使得它们不适用于 Linux 内核中这种由外部因素导致的过时问题。因此,我们提出 ReCite,这是一种三阶段方法,用于识别和修复此类过时引用:(1)检测未解析的函数形式符号——注释中看似引用函数但在当前代码库中找不到匹配函数的符号;(2)通过 Git 历史追踪每个未解析符号的演化历史;(3)基于演化历史和当前代码上下文生成基于 LLM 的修复建议。在 Linux 内核 v6.18-rc1 上,ReCite 检测到 869 个过时引用并生成了修复建议。对 200 个抽样修复的人工评估显示,178 个(89.0%)提供了有用的修复指导,其中 85 个(42.5%)可直接应用。在我们提交的 75 个补丁中,50 个已被接受。我们还对所有未解析的函数形式符号进行了实证研究。
英文摘要
As the Linux kernel evolves, code comments may become outdated, as the functions they reference can be refactored or removed independently without corresponding updates to the comments. Such stale function references can mislead maintainers and thus hinder code comprehension. Prior work on detecting code-comment inconsistency mainly focused on addressing semantic misalignment between Javadoc comments and their directly annotated functions, making them inapplicable to this type of externally induced staleness in the Linux kernel. Therefore, we propose ReCite, a three-stage approach to identify and repair such stale references: (1) detecting unresolved function-form symbols -- symbols in comments that appear to reference functions but for which no matching function can be found in the current codebase, (2) tracing the evolution history of each unresolved symbol through the Git history, and (3) generating LLM-based repair suggestions grounded in the evolution history and current code context. On Linux kernel v6.18-rc1, ReCite detects 869 stale references with generated repair suggestions. A manual evaluation on 200 sampled repairs shows that 178 (89.0%) provide useful repair guidance, with 85 (42.5%) directly applicable. Of our 75 submitted patches, 50 have been accepted. We also empirically study all unresolved function-form symbols.