CLIR: Liveness-Driven and Structure-Aware Fuzzing for the Cranelift Compiler

· Source: cs.SE updates on arXiv.org · Field: Technology & Digital — Software Development & Engineering, Cybersecurity & Data Privacy, Emerging Technologies & Innovation · Depth: Expert, extended

Summary

CLIR, a novel differential testing framework, significantly enhances bug detection and code coverage for the Cranelift compiler backend, which is used for WebAssembly and Rust. It addresses challenges in constructing valid SSA-form IR, generating computationally dense sequences, and facilitating root cause analysis across heterogeneous architectures like x86-64, AArch64, s390x, and RISCV64. CLIR integrates a syntax-preserving hierarchical generation strategy, a liveness-guided instruction refinement mechanism, and a diagnosis-guided cross-architecture adaptation scheme. In a 72-hour evaluation, CLIR detected 24 unique bugs, outperforming cranelift-fuzzgen, wasm-smith, and WASMaker by 8x, 24x, and 8x respectively, while RustSmith found none. It also achieved 68.4% to 79.1% code coverage across architectures, a 1.2x improvement. Of the discovered bugs, 21 were confirmed and 9 fixed.

Key takeaway

For research scientists or compiler engineers testing new compiler backends like Cranelift, you should consider adopting CLIR's structured fuzzing approach. Its ability to generate complex, valid IR and diagnose cross-architecture issues efficiently will uncover more deep-seated bugs than traditional methods. Implement its liveness-guided refinement to ensure your test cases stress critical compiler components effectively.

Key insights

CLIR improves compiler testing by generating complex, valid IR and efficiently diagnosing cross-architecture bugs.

Principles

Method

CLIR uses a skeleton generator, an IR initiator with corpus-based snippets and dominator-driven SSA instantiation, and a differential testing module with instrumentation and feedback-driven adaptation.

In practice

Topics

Code references

Best for: AI Scientist, Software Engineer, Research Scientist, Security Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.