CLIR:面向Cranelift编译器的活性驱动与结构感知模糊测试
CLIR: Liveness-Driven and Structure-Aware Fuzzing for the Cranelift Compiler
AI总结:
提出CLIR差分测试框架,通过语法保持的分层生成保证SSA合法性、活性引导指令精炼最大化计算密度、诊断引导跨架构适配加速根因分析,在72小时内发现24个跨架构bug。
摘要:
现代编译器是复杂的软件系统,必须正确地将高级编程语言翻译为跨多种架构的机器码。Cranelift是一个快速且现代的编译器后端,最初为WebAssembly开发,最近被采纳为Rust的实验性后端,因其相比LLVM更优越的编译速度和全面的多架构支持(包括x86-64、AArch64、s390x和RISCV64)而日益重要。然而,尽管编译器测试已发展数十年,测试Cranelift仍面临独特挑战,包括:(1)在SSA形式的严格约束下构造有效IR,(2)生成具有足够计算密度的序列以压力测试后端组件,(3)在异构架构间平衡广泛的后端覆盖与高效的根因分析。为应对这些挑战,我们提出CLIR,一个差分测试框架,集成了语法保持的分层生成策略以保证SSA合法性、活性引导的指令精炼机制以最大化计算密度,以及诊断引导的跨架构适配方案以促进异构后端的高效根因分析。我们的全面评估表明,CLIR显著优于现有最先进基线,分别比cranelift-fuzzgen、wasm-smith和WASMaker检测到8倍、24倍和8倍更多的独特bug,而RustSmith未发现任何bug。因此,在72小时的测试中,CLIR发现了覆盖所有目标架构的24个bug,其中21个已确认,9个已修复。
英文摘要:
Modern compilers are complex software systems that must correctly translate high-level programming languages into machine code across multiple architectures. Cranelift, a fast and modern compiler backend originally developed for WebAssembly and recently adopted as an experimental backend for Rust, has gained increasing importance due to its superior compilation speed compared to LLVM and comprehensive multi-architecture support, including x86-64, AArch64, s390x, and RISCV64. However, despite decades of development in compiler testing, testing Cranelift still presents unique challenges, including (1) constructing valid IR under the strict enforcement of SSA form, (2) generating sequences with sufficient computational density to stress backend components, and (3) balancing broad backend coverage with efficient root cause analysis across heterogeneous architectures. To address these challenges, we propose CLIR, a differential testing framework that integrates a syntax-preserving hierarchical generation strategy to guarantee SSA validity, a liveness-guided instruction refinement mechanism to maximize computational density, and a diagnosis-guided cross-architecture adaptation scheme to facilitate efficient root cause analysis across heterogeneous backends. Our comprehensive evaluation demonstrates that CLIR significantly outperforms existing state-of-the-art baselines, detecting 8x, 24x, and 8x more unique bugs than cranelift-fuzzgen, wasm-smith, and WASMaker, respectively, while RustSmith uncovered no bugs. Consequently, within 72 hours of testing, CLIR discovered 24 bugs spanning all target architectures, with 21 confirmed and 9 fixed.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。