arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.05256cs.SE
收藏

IRFuzzer:针对LLVM后端代码生成的专用模糊测试

IRFuzzer: Specialized Fuzzing for LLVM Backend Code Generation

Yuyang Rong, Zhanghan Yu, Zhenkai Weng, Stephen Neuendorffer, Hao Chen

AI总结:

本文提出IRFuzzer,通过约束变异生成有效LLVM IR输入并引入匹配器表覆盖率反馈,对LLVM后端代码生成进行专用模糊测试,在29个后端目标中发现74个已确认新错误,显著提升了测试效果。

摘要:

现代编译器(如LLVM)是复杂的软件。由于其复杂性,手动测试不太可能足够,而形式化验证又难以扩展。端到端模糊测试可以使用,但难以实现对LLVM某些组件的高覆盖率。在本文中,我们实现了IRFuzzer来研究LLVM编译器后端专用模糊测试的有效性。我们专注于两种改进模糊测试器的方法:使用约束变异保证输入有效性,以及提高反馈质量。IRFuzzer中的变异器能够生成多种LLVM IR输入,包括结构化控制流、向量类型和函数定义。该系统对编译器中的代码模式进行插桩,以监控指令选择的执行状态。这种插桩不仅提供了一种称为匹配器表覆盖率的新覆盖反馈,还为变异器提供了特定于架构的指导。我们通过对29个成熟的LLVM后端目标进行模糊测试,证明IRFuzzer比现有模糊测试器更有效。在此过程中,我们报告了LLVM上游中74个已确认的新错误,其中49个已修复,5个已向后移植到LLVM 15,这表明专用模糊测试为LLVM开发者提供了有用且可操作的见解。

英文摘要:

Modern compilers, such as LLVM, are complex pieces of software. Due to their complexity, manual testing is unlikely to suffice, yet formal verification is difficult to scale. End-to-end fuzzing can be used, but it has difficulties in achieving high coverage of some components of LLVM. In this paper, we implement IRFuzzer to investigate the effectiveness of specialized fuzzing of the LLVM compiler backend. We focus on two approaches to improve the fuzzer: guaranteed input validity using constrained mutations and improved feedback quality. The mutator in IRFuzzer is capable of generating a wide range of LLVM IR inputs, including structured control flow, vector types, and function definitions. The system instruments coding patterns in the compiler to monitor the execution status of instruction selection. The instrumentation not only provides a new coverage feedback called matcher table coverage, but also provides an architecture specific guidance to the mutator. We show that IRFuzzer is more effective than existing fuzzers by fuzzing on 29 mature LLVM backend targets. In the process, we reported 74 confirmed new bugs in LLVM upstream, out of which 49 have been fixed, five have been back ported to LLVM 15, showing that specialized fuzzing provides useful and actionable insights to LLVM developers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑