一句话:提出 MIP,让 LLM、编译器与代码分析工具协作,自动消解补丁移植中需要跨库全局映射知识的隐式不一致。
将补丁从源代码库及时移植到其变体(fork、分支)对遏制缺陷与漏洞传播至关重要。现有自动化补丁移植方法主要处理补丁局部上下文中可见的不一致,对需要代码库间全局映射知识的“隐式不一致”(implicit inconsistencies)无能为力,这类非局部不一致对开发者而言更难解决。本文提出 MIP,让 LLM、编译器与代码分析工具协同工作:当源标识符在目标代码库中存在时,借助编译器诊断信息;否则从两个代码库中检索相互匹配的代码片段对,作为消解所需的映射知识。在跨 fork 与跨分支两种代表性移植场景上的实验表明,MIP 成功解决的补丁数量均为最佳基线的两倍以上;与工业合作伙伴开展的用户研究也验证了其实用性。
Promptly porting patches from a source codebase to its variants (e.g., forks and branches) is essential for mitigating propagated defects and vulnerabilities. Recent studies have explored automated patch porting to reduce manual effort and delay, but existing approaches mainly handle inconsistencies visible in a patch's local context and struggle with those requiring global mapping knowledge between codebases. We refer to such non-local inconsistencies as implicit inconsistencies. Implicit inconsistencies pose greater challenges for developers to resolve due to their non-local nature. To address them, we propose MIP, which enables collaboration among an LLM, a compiler, and code analysis utilities. MIP adopts different strategies for different cases: when source identifiers exist in the target codebase, it leverages compiler diagnostics; otherwise, it retrieves matched code segment pairs from the two codebases as mapping knowledge for mitigation. Experiments on two representative scenarios, cross-fork and cross-branch patch porting, show that MIP successfully resolves more than twice as many patches as the best-performing baseline in both settings. A user study with our industry partner further demonstrates its practical effectiveness.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2604-01680,
title = {Mitigating Implicit Inconsistencies in Patch Porting},
author = {Shengyi Pan and Zhongxin Liu and Jiayuan Zhou and Xing Hu and Xin Xia and Shanping Li},
booktitle = {FSE},
year = {2026},
doi = {10.1145/3803437.3805248}
}