[论文解读] Automatic Repair of Infinite Loops
本文提出 $/mathit{Infinitel}$,一种用于自动修复无限循环的技巧,通过动态循环插桩技术监控迭代次数和运行时状态,再利用满足模理论(SMT)求解生成正确的循环条件。该方法在标准硬件上于数秒至一小时内成功修复了七个植入的错误和七个真实世界的无限循环错误。
Research on automatic software repair is concerned with the development of systems that automatically detect and repair bugs. One well-known class of bugs is the infinite loop. Every computer programmer or user has, at least once, experienced this type of bug. We state the problem of repairing infinite loops in the context of test-suite based software repair: given a test suite with at least one failing test, generate a patch that makes all test cases pass. Consequently, repairing infinites loop means having at least one test case that hangs by triggering the infinite loop. Our system to automatically repair infinite loops is called $Infinitel$. We develop a technique to manipulate loops so that one can dynamically analyze the number of iterations of loops; decide to interrupt the loop execution; and dynamically examine the state of the loop on a per-iteration basis. Then, in order to synthesize a new loop condition, we encode this set of program states as a code synthesis problem using a technique based on Satisfiability Modulo Theory (SMT). We evaluate our technique on seven seeded-bugs and on seven real-bugs. $Infinitel$ is able to repair all of them, within seconds up to one hour on a standard laptop configuration.
研究动机与目标
- 通过实现无限循环的自动修复,应对软件错误带来的高昂维护成本,此类错误属于常见且具有破坏性的缺陷类别。
- 通过利用无限循环在结构和行为上的特征,开发一种针对无限循环的专用修复方法,区别于通用修复工具。
- 实现正确循环条件的自动合成,确保挂起的测试用例能够终止,同时保持通过测试用例的正确性。
- 通过提供静态、离线的修复方案,克服现有仅检测或运行时逃逸方法的局限性。
- 评估基于 SMT 的代码合成在真实世界与植入错误场景下修复无限循环的可行性与有效性。
提出的方法
- 对源代码进行插桩,以动态跟踪每次迭代的循环迭代次数、执行状态和变量值。
- 利用运行时分析检测触发无限循环的挂起测试用例,并收集其执行轨迹。
- 将收集到的运行时状态表示为一组满足模理论(SMT)求解的约束条件。
- 将修复任务建模为代码合成问题,目标是生成一个能确保循环终止和正确性的新循环条件。
- 使用 SMT 求解器生成新的循环保护条件,确保所有测试用例通过且循环能够终止。
- 将生成的条件集成到原始代码中,生成正确的补丁。
实验结果
研究问题
- RQ1能否通过基于测试套件的修复方法,结合动态插桩与基于 SMT 的代码合成,实现无限循环的自动修复?
- RQ2与植入错误相比,该方法在修复真实世界无限循环错误方面的有效性如何?
- RQ3该技术是否能够在不依赖谱故障定位或变异算子的情况下检测并修复无限循环?
- RQ4动态插桩与 SMT 求解流水线在真实程序上的性能开销与可扩展性如何?
- RQ5该方法是否能推广到其他与循环相关的缺陷,例如错误的循环边界?
主要发现
- $\mathit{Infinitel}$ 在标准笔记本电脑上,于数秒至一小时内成功修复了全部七个植入错误和七个真实世界的无限循环错误。
- 动态插桩技术实现了对循环状态在各次迭代中的精确监控,从而能够准确检测无限循环的触发条件。
- 基于 SMT 的代码合成生成了正确的循环条件补丁,确保所有测试用例下循环都能终止且保持正确性。
- 与仅检测的工具(如 $\mathit{Jolt}$ 和 $\mathit{NoPol}$)相比,该方法表现更优,因其生成的是语义正确的补丁,而非仅实现运行时逃逸。
- 该方法在多种程序上表现出稳健性,包括真实示例如 grep 命令的无限循环修复。
- 即使在涉及匿名类和嵌套循环结构的复杂情况下,该技术也有效,尽管在插桩过程中字段访问方面存在一些局限性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。