Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AFLplusplus/AFLplusplus/llms.txt
Use this file to discover all available pages before exploring further.
Overview
LAF-Intel (Lost AFL Intel) provides compiler transformations that help AFL++ enter conditional blocks where conditions consist of comparisons of large values. By splitting complex comparisons into simpler ones, it dramatically improves the fuzzer’s ability to discover new paths.Originally developed by an individual nicknamed “laf-intel” and described in the blog post Circumventing Fuzzing Roadblocks with Compiler Transformations.
The Problem
Consider this code:0x12345678 - requiring approximately 1 in 4 billion attempts!
The Solution
LAF-Intel transforms the comparison into multiple smaller comparisons:Transformation Passes
LAF-Intel includes three main transformation passes:1. Split Switches
Transforms switch statements into separate conditional blocks. Enable with:2. Transform Compares
Splits string comparison functions into byte-by-byte comparisons. Enable with:strcmpstrncmpmemcmpstrcasecmpstrncasecmp
3. Split Compares
Splits integer comparisons into chains of smaller comparisons. Enable with:- Simplifies
>=and<=into chains of>(or<) and== - Changes signed integer comparisons to chains of sign comparison + unsigned comparison
- Splits unsigned integer comparisons (64, 32, 16 bit) into 8-bit comparisons
Configuration Options
Basic Usage
Enable split-switches pass.
Enable transform-compares pass for string comparison functions.
Enable split-compares pass for integer comparisons.
Advanced Configuration
Set the bit width for splitting comparisons. Options:
64, 32, or 16.64: Split only 64-bit comparisons (minimal splitting)32: Split 64 and 32-bit comparisons16: Split 64, 32, and 16-bit comparisons- Default:
8(split all down to 8-bit)
Split floating-point comparisons into sign, exponent, and mantissa comparisons.
Automatically activates
AFL_LLVM_LAF_SPLIT_COMPARES.Enable all LAF-Intel transformations at once.Equivalent to setting:
AFL_LLVM_LAF_SPLIT_SWITCHES=1AFL_LLVM_LAF_TRANSFORM_COMPARES=1AFL_LLVM_LAF_SPLIT_COMPARES=1
Usage Examples
Enable All Transformations (Recommended)
Selective Transformations
Custom Bit Width
With Floating-Point Support
Compiler Compatibility
LAF-Intel works with all LLVM-based instrumentation modes:- LLVM Mode
- LTO Mode
- GCC Plugin
Performance Considerations
Binary Size
LAF-Intel transformations increase binary size:| Transformation | Size Increase |
|---|---|
| Split switches | +10-30% |
| Transform compares | +20-50% |
| Split compares | +50-200% |
| All enabled | +100-300% |
Execution Speed
More comparisons = more instrumentation = slower execution:| Setting | Speed Impact |
|---|---|
| No LAF-Intel | Baseline |
| Selective (switches only) | -5 to -15% |
| Split compares | -20 to -50% |
| All transformations | -30 to -70% |
Coverage Improvement
Typical improvements in path discovery:- Magic bytes: 100-1000x faster discovery
- Multi-byte comparisons: 10-100x faster
- Switch statements: 2-10x more paths found
- Overall coverage: 20-50% more edges discovered
Use Cases
File Format Parsers
File Format Parsers
Protocol Implementations
Protocol Implementations
Checksum Validation
Checksum Validation
State Machines
State Machines
Comparison with CmpLog
| Feature | LAF-Intel | CmpLog |
|---|---|---|
| Approach | Compile-time transformation | Runtime logging |
| String compares | ✅ Excellent | ✅ Excellent |
| Integer compares | ✅ Excellent | ⚠️ Limited |
| Switch statements | ✅ Yes | ❌ No |
| Magic bytes | ✅ Good | ✅ Excellent |
| Binary size | Larger | Separate binary |
| Performance | Slower execution | Occasional slowdown |
| Memory overhead | Lower | Higher |
Complete Example
Troubleshooting
Compilation Failures
Symptom: Target fails to compile with LAF-Intel enabled Solutions:-
Try disabling individual passes to identify the problematic one:
-
Some optimizations may conflict. Try disabling optimizations:
Binary Too Large
Symptom: Instrumented binary is excessively large Solutions:-
Use selective instrumentation:
-
Use less aggressive bit width:
-
Enable only necessary transformations:
No Coverage Improvement
Symptom: LAF-Intel doesn’t improve coverage Possible reasons:- Target has few large comparisons
- Bottleneck is elsewhere (try CmpLog)
- Need longer fuzzing time to see benefits
Best Practices
-
Start with all transformations enabled:
-
Combine with LTO mode for best performance:
-
Use with CmpLog for maximum effectiveness:
- Monitor binary size - if too large, selectively disable transformations
- Test stability - ensure transformations don’t break functionality
Next Steps
CmpLog
Combine with CmpLog for maximum comparison handling
LTO Mode
Use collision-free instrumentation for better coverage
Persistent Mode
Add persistent mode for 10-20x speedup
Selective Instrumentation
Instrument only specific parts of code

