一句话:提出专用模糊测试器 IRFuzzer,以约束变异和指令选择插桩反馈发现 LLVM 后端代码生成缺陷。
LLVM 等现代编译器后端复杂,人工测试不足,形式验证难规模化;端到端模糊测试又受前端与中端优化屏蔽,难为后端提供多样输入,且分支覆盖因后端可复用代码多而反馈效果有限。作者实现专用模糊测试器 IRFuzzer:用约束变异保证 LLVM IR 输入有效性并提升多样性,可生成结构化控制流、向量类型与函数定义;插桩编译器中的编码模式来监控指令选择,对匹配表提供新覆盖反馈,并引导架构专用 intrinsic 变异。在 29 个成熟 LLVM 后端目标上,IRFuzzer 发现 78 个上游确认的新缺陷,均为现有 fuzzer 未能发现;开发者已修复 57 个,5 个修复回移 LLVM 15。
Modern compilers, such as LLVM, are complex. 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 discovering LLVM backend problems for two reasons. First, frontend preprocessing and middle optimization shield the backend from seeing diverse inputs. Second, branch coverage cannot provide effective feedback as LLVM backend contains much reusable code. In this paper, we implement IRFuzzer to investigate the need of specialized fuzzing of the LLVM compiler backend. We focus on two approaches to improve the fuzzer: guaranteed input validity using constrained mutations to improve input diversity and new metrics to improve feedback quality. The mutator in IRFuzzer can generate 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 new coverage feedback on the matcher table but also guides the mutator on architecture-specific intrinsics. We ran IRFuzzer on 29 mature LLVM backend targets. IRFuzzer discovered 78 new, confirmed bugs in LLVM upstream, none of which existing fuzzers could discover. This demonstrates that IRFuzzer is far more effective than existing fuzzers. Upon receiving our bug report, the developers have fixed 57 bugs and back-ported five fixes to LLVM 15, which shows that specialized fuzzing provides actionable insights to LLVM developers.
DOI 原文 ·
@inproceedings{paperbot8792,
title = {IRFuzzer: Specialized Fuzzing for LLVM Backend Code Generation},
author = {Yuyang Rong and Zhanghan Yu and Zhenkai Weng and Stephen Neuendorffer and Hao Chen},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00130}
}