一句话:提出 Amur,用流敏感、跨资源感知的资源流分析引导 LLM,为单资源与多资源泄漏生成语义保持的修复补丁。
资源泄漏会导致资源耗尽、性能下降乃至系统崩溃,但基于模板的自动修复难以处理复杂或多资源泄漏且易破坏程序语义,基于大语言模型(LLM)的方法也常生成语义无效的补丁。本文提出 Amur,一个语义感知的补丁修复框架,其核心是新的资源流分析(RFA):一种流敏感、跨资源感知的静态分析,用于刻画资源使用模式与资源间依赖,定位潜在泄漏点并施加语义约束,从而引导 LLM 合成语义保持的补丁。作者在 NJR-1 数据集与面向真实多资源泄漏场景的新基准 JLeaks 上评估 Amur。结果显示,单资源泄漏下补丁准确率比 RLFixer 高 33%、比纯 LLM 基线高 24%;多资源泄漏下 96% 的案例能生成补丁且正确率达 80%,分别比 RLFixer 与纯 LLM 基线高 76% 和 16%。
Resource leaks pose a persistent threat to software reliability, resulting in resource exhaustion, performance degradation, and system crashes. Existing automated repair approaches, primarily based on rigid templates, are limited in handling complex or multi-resource leak scenarios and often compromise program semantics. Although recent advances in Large language models show promise in program repair, existing LLM-based methods frequently generate semantically invalid patches for resource leaks. This paper presents Amur, a semantics-aware patching framework that leverages static analysis to guide LLMs in repairing both single- and multi-resource leaks. At the core of Amur is a novel Resource Flow Analysis (RFA), a flow-sensitive and inter-resource-aware static analysis that captures resource usage patterns and dependencies. RFA identifies potential leak points and enforces semantic constraints to guide LLMs in synthesizing semantics-preserving patches. We evaluate Amur on the NJR-1 dataset and the new JLeaks benchmark, which targets realistic multi-resource leak scenarios. Amur achieves substantial improvements over state-of-the-art methods, improving patch accuracy by 33% over RLFixer and 24% over LLM-only baselines in single-resource leak cases. For multi-resource leaks, Amur generates patches in 96% of cases and achieves 80% correctness, outperforming RLFixer and LLM-only baselines by 76% and 16%, respectively. These results demonstrate that integrating RFA into LLM-guided repair significantly enhances the correctness and generalizability of automated resource leak fixes.
DOI 原文 ·
@inproceedings{paperbot9528,
title = {Amur: Fixing Multi-Resource Leaks Guided by Resource Flow Analysis},
author = {Jinyoung Kim and Eunseok Lee},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00252}
}