一句话:提出 FLUX,以人工 LLVM IR 单元测试为种子随机组合生成测试,暴露编译器优化缺陷。
编译器优化缺陷会导致编译产物行为异常,但已有编译器 fuzzing 多面向端到端流程,难以定向探索优化。FLUX 不从头构造良构输入,而以人工编写的单元测试套件为起点,随机选择并组合测试来生成新测试,以探索优化中的新执行路径并发现缺陷。作者在 LLVM 上评估:相比基线单元测试套件提升路径覆盖率,并比先前工作覆盖更多边;可生成触发误编译和崩溃的 IR。一个月 fuzzing 中,FLUX 在 LLVM 活跃开发分支发现 28 个唯一缺陷,报告 11 个,其中 6 个被修补;22 个为良构输入触发的崩溃,6 个为静默产生错误代码的误编译。
Optimizing compilers are as ubiquitous as they are crucial to software development. However, bugs in compilers are not uncommon. Among the most serious are bugs in compiler optimizations, which can cause unexpected behavior in compiled binaries. Existing approaches for detecting such bugs have focused on end-to-end compiler fuzzing, which limits their ability for targeted exploration of a compiler's optimizations. This paper proposes FLUX (Finding bugs with LLVM IR based Unit test cross(X)overs), a fuzzer that is designed to generate test cases that stress compiler optimizations. Previous compiler fuzzers are overly constrained by having to construct well-formed inputs. FLUX sidesteps this constraint by using human-written unit test suites as a starting point, and then selecting random combinations of them to generate new tests. We hypothesize that tests generated this way will be able to explore new execution paths through compiler optimizations and find new bugs. Our evaluation of FLUX on LLVM indicates that it is able to increase path coverage over the baseline LLVM unit test suite and explores more edge coverage than previous work. Further, we demonstrate FLUX's ability to generate miscompiled and crash-producing IR on LLVM's optimizations. After a month of fuzzing, FLUX found 28 unique bugs in LLVM's active development branch. We have reported 11 of these bugs which led to 6 of them being patched by LLVM developers. 22 of these are crashes that are triggered by well-formed input programs, and 6 of these are miscompilation bugs that silently produced incorrect code.