[论文解读] Gauntlet: Finding Bugs in Compilers for Programmable Packet Processing
Gauntlet 是一种领域特定工具,结合了随机程序生成、自动化翻译验证和基于模型的测试,用于检测 P4 16 编译器中的编译器错误。它在 P4C、P4 参考软件交换机和 Barefoot Tofino 后端中发现了 96 个不同的错误——其中 62 个为崩溃错误,34 个为语义问题,已有 54 个被修复,该工具现已集成到 P4C 的 CI 流水线中。
Programmable packet-processing devices such as programmable switches and network interface cards are becoming mainstream. These devices are configured in a domain-specific language such as P4, using a compiler to translate packet-processing programs into instructions for different targets. As networks with programmable devices become widespread, it is critical that these compilers be dependable. This paper considers the problem of finding bugs in compilers for packet processing in the context of P4-16. We introduce domain-specific techniques to induce both abnormal termination of the compiler (crash bugs) and miscompilation (semantic bugs). We apply these techniques to (1) the open-source P4 compiler (P4C) infrastructure, which serves as a common base for different P4 back ends; (2) the P4 back end for the P4 reference software switch; and (3) the P4 back end for the Barefoot Tofino switch. Across the 3 platforms, over 8 months of bug finding, our tool Gauntlet detected 96 new and distinct bugs (62 crash and 34 semantic), which we confirmed with the respective compiler developers. 54 have been fixed (31 crash and 23 semantic); the remaining have been assigned to a developer. Our bug-finding efforts also led to 6 P4 specification changes. We have open sourced Gauntlet at p4gauntlet.github.io and it now runs within P4C's continuous integration pipeline.
研究动机与目标
- 为可编程数据包处理设备中可靠编译器的迫切需求提供支持,这些设备是现代网络基础设施的核心。
- 通过利用 P4 的领域特定约束(如无循环和指针)来克服通用编译器错误查找技术的局限性。
- 开发一种可扩展、自动化且精确的方法,用于检测 P4 编译器中的崩溃错误和语义错误。
- 将该工具集成到持续集成流水线中,以实现对编译器正确性的持续自动化验证。
提出的方法
- 随机生成语法正确且类型正确的 P4 程序,以触发编译器崩溃,利用 P4 的最小未定义行为来简化测试生成。
- 使用形式化语义实施自动化翻译验证,以验证编译器各阶段的正确性,得益于 P4 中有界结构带来的程序等价性是有限且可判定的。
- 使用基于模型的测试,根据形式化语义生成输入-输出数据包对,从而在无需访问中间表示的情况下对编译器进行黑盒测试。
- 开发 P4 16 的形式化解释器和语义,以支持翻译验证和基于模型的测试,减少对每一轮编译器阶段进行手动验证的依赖。
- 将 Gauntlet 集成到 P4C 的 CI 流水线中,以实现持续的自动化回归测试,并及早发现回归问题。
- 通过扩展模型支持目标特定的 extern,尽管在缺乏底层硬件知识的情况下,这些 extern 的精确语义仍具挑战性。
实验结果
研究问题
- RQ1与通用编程语言相比,P4 的领域特定约束是否可以被利用来简化并自动化编译器错误查找?
- RQ2在 P4 这类 DSL 中,自动化翻译验证在多大程度上可以实现精确性和可扩展性,其中程序等价性是可判定的?
- RQ3随机程序生成、翻译验证和基于模型的测试相结合,在发现生产环境中 P4 编译器的真实错误方面有多有效?
- RQ4此类工具是否可以集成到 CI 流水线中,以实现持续验证并提高编译器的长期可靠性?
主要发现
- Gauntlet 在三个 P4 编译器后端中检测到 96 个新的且不同的编译器错误:62 个崩溃错误和 34 个语义错误。
- 在报告的 96 个错误中,54 个已修复(31 个崩溃错误和 23 个语义错误),其余 42 个已分配给开发人员进行修复。
- 该工具促使 P4 语言规范进行了 6 处修改,表明其对语言设计和标准化产生了影响。
- Gauntlet 已集成到 P4C 的持续集成流水线中,实现了持续的自动化回归测试。
- 该方法表明,具有受限语义的领域特定语言允许实现精确、自动化且可扩展的编译器验证,克服了以往通用技术的局限性。
- Gauntlet 的成功表明,类似技术可推广至其他领域特定语言,尤其是那些具有可判定语义和有限未定义行为的语言。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。