GWP-ASan detects use-after-free and buffer overflow bugs in production with near-zero overhead
GWP-ASan can detect heap memory-safety bugs in production environments with negligible performance impact.
Security & privacy Trail of Bits 16 Dec 2025 Tooling Deployed evidence
Published as “Use GWP-ASan to detect exploits in production environments”
Why it matters
Enables production software to catch critical memory-safety bugs that would otherwise go unnoticed, improving security with minimal performance cost.
Summary
The post explains how GWP-ASan, a sampling-based allocation sanitizer, instruments a tiny fraction of heap allocations and places them in pages with guard pages. By doing so it can catch double-free, use-after-free, and heap-buffer-overflow errors in live software while guarding less than 0.1% of allocations. Benchmarks show linear runtime growth with the number of sampled allocations, but with typical sample rates the overhead is negligible, and the technique is already deployed in Chrome, Android, Firefox Nightly, and other projects.
What they found 2
- GWP-ASan typically guards less than 0.1% of allocations, creating negligible performance overhead.
“GWP-ASan typically guards less than 0.1% of allocations, creating negligible performance overhead.”
- Scudo allocator without GWP-ASan is faster than the standard allocator.
“Figure 9 shows that the Scudo allocator has much better (smaller) times than the standard allocator.”
Caveats 6
- Because GWP-ASan has very big CPU overhead, for our tests we’ll change the value of the variable N from figure 7 to 256 (N=256) and reduce the number of loops in the main function (figure 8) to 10,000.
- bugs detected by GWP-ASan could have occurred before being detected-the number of occurrences depends on the sampling rate.
- Only a sampled fraction of allocations are protected; unsampled allocations are not checked.
- Small buffer overruns may be missed due to alignment gaps between guard pages.
- Detection is probabilistic; the same bug may not be caught on every execution.
- Performance overhead increases as SampleRate is lowered (more allocations sampled).
What’s new here 4
- Sampling-based allocation sanitization that can be enabled in production with near-zero overhead
- Integration with LLVM's Scudo allocator and simple environment-variable configuration
- Real-world deployment in Chrome, Android system services, Firefox Nightly, and WebKit
- Guidance on tuning SampleRate and MaxSimultaneousAllocations to balance detection vs. performance