Google's ASan, introduced in 2012, uses a shadow memory scheme to detect memory bugs. It is available in:
On average, the instrumentation increases processing time by about 73% and memory usage by 240%.5 There is a hardware-accelerated ASan called HWAsan available for AArch64 and (in a limited fashion) x86_64.6
AddressSanitizer does not detect any uninitialized memory reads (but this is detected by MemorySanitizer7), and only detects some use-after-return bugs.8 It is also not capable of detecting all arbitrary memory corruption bugs, nor all arbitrary write bugs due to integer underflow/overflows (when the integer with undefined behavior is used to calculate memory address offsets). Adjacent buffers in structs and classes are not protected from overflow, in part to prevent breaking backwards compatibility.9
The KernelAddressSanitizer (KASan) detects dynamic memory errors in the Linux kernel.10 Kernel instrumentation requires a special feature in the compiler supplying the -fsanitize=kernel-address command line option, since kernels do not use the same address space as normal programs.1112
KASan is also available for use with Windows kernel drivers beginning in Windows 11 22H2 and above.13 Similarly to Linux, compiling a Windows driver with KASAN requires passing the /fsanitize=kernel-address command line option to the MSVC compiler.
Google also produced LeakSanitizer (LSan, memory leaks), ThreadSanitizer (TSan, data races and deadlocks), MemorySanitizer (MSan, uninitialized memory), and UndefinedBehaviorSanitizer (UBSan, undefined behaviors, with fine-grained control).14 These tools are generally available in Clang/LLVM and GCC.151617 Similar to KASan, there are kernel-specific versions of LSan, MSan, TSan, as well as completely original kernel sanitizers such as KFENCE and KCSan.18
Additional sanitizer tools (grouped by compilers under -fsanitize or a similar flag) include:192021
A code sanitizer detects suspicious behavior as the program runs. One common way to use a sanitizer is to combine it with fuzzing, which generates inputs likely to trigger bugs.24
Chromium and Firefox developers are active users of AddressSanitizer;2526 the tool has found hundreds of bugs in these web browsers.27 A number of bugs were found in FFmpeg28 and FreeType.29 The Linux kernel has enabled the AddressSanitizer for the x86-64 architecture as of Linux version 4.0.
"LLVM 3.1 Release Notes". LLVM. Retrieved 8 February 2014. http://llvm.org/releases/3.1/docs/ReleaseNotes.html#whatsnew ↩
"GCC 4.8 Release Notes". GCC. Retrieved 8 February 2014. https://gcc.gnu.org/gcc-4.8/changes.html ↩
"Address Sanitizer | Apple Developer Documentation". https://developer.apple.com/documentation/code_diagnostics/address_sanitizer ↩
"Visual Studio 2019 version 16.9 Release Notes". Microsoft. Retrieved 5 March 2021. https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.9.0 ↩
Konstantin Serebryany; Derek Bruening; Alexander Potapenko; Dmitry Vyukov. "AddressSanitizer: a fast address sanity checker" (PDF). Proceedings of the 2012 USENIX conference on Annual Technical Conference. https://www.usenix.org/system/files/conference/atc12/atc12-final39.pdf ↩
"Hardware-assisted AddressSanitizer Design Documentation — Clang 17.0.0git documentation". clang.llvm.org. https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html ↩
"MemorySanitizer". GitHub. https://github.com/google/sanitizers/wiki/MemorySanitizer ↩
"ComparisonOfMemoryTools". AddressSanitizer Wiki. Retrieved 1 December 2017. https://github.com/google/sanitizers/wiki/AddressSanitizerComparisonOfMemoryTools ↩
"Bypassing AddressSanitizer" (PDF). Eric Wimberley. Retrieved 1 July 2014. http://dl.packetstormsecurity.net/papers/general/BreakingAddressSanitizer.pdf ↩
"KernelAddressSanitizer (KASAN)". Archived from the original on 2015-09-15. https://web.archive.org/web/20150915180313/http://lxr.free-electrons.com/source/Documentation/kasan.txt ↩
Jake Edge. "The kernel address sanitizer". https://lwn.net/Articles/612153/ ↩
Jonathan Corbet. "3.20 merge window part 2". https://lwn.net/Articles/633096/ ↩
"Kernel Address Sanitizer (KASAN)". Archived from the original on 2024-11-04. https://web.archive.org/web/20241104171917/https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/kasan ↩
Google (2 March 2023). "sanitizers: This project is the home for Sanitizers: AddressSanitizer, MemorySanitizer, ThreadSanitizer, LeakSanitizer, and more". GitHub. Google. {{cite web}}: |last1= has generic name (help) https://github.com/google/sanitizers ↩
"sanitizer - The Rust Unstable Book". doc.rust-lang.org. This feature allows for use of one of following sanitizers: [...] ControlFlowIntegrity LLVM Control Flow Integrity https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html ↩
"Clang Compiler User's Manual — Clang 17.0.0git documentation". clang.llvm.org. -f[no-]sanitize=check1,check2,... Turn on runtime checks for various forms of undefined or suspicious behavior https://clang.llvm.org/docs/UsersManual.html#cmdoption-f-no-sanitize ↩
"Instrumentation Options (Using the GNU Compiler Collection (GCC))". gcc.gnu.org. https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html ↩
"Linux Kernel Sanitizers". Google. 2 March 2023. https://github.com/google/kernel-sanitizers ↩
"GWP-ASan — LLVM 17.0.0git documentation". llvm.org. https://llvm.org/docs/GwpAsan.html ↩
"libFuzzer – a library for coverage-guided fuzz testing. — LLVM 17.0.0git documentation". llvm.org. https://llvm.org/docs/LibFuzzer.html?highlight=fsanitize ↩
Abhishek Arya; Cris Neckar; Chrome Security Team. "Fuzzing for Security". https://blog.chromium.org/2012/04/fuzzing-for-security.html ↩
"Securing Firefox: Trying new code analysis techniques". Archived from the original on 2016-03-07. Retrieved 2018-06-18. https://web.archive.org/web/20160307095743/https://blog.mozilla.org/decoder/2012/01/27/trying-new-code-analysis-techniques/#more-14 ↩
"Some of the bugs found by AddressSanitizer". GitHub. https://github.com/google/sanitizers/wiki/AddressSanitizerFoundBugs ↩
Mateusz Jurczyk; Gynvael Coldwind (2014-01-10). "FFmpeg and a thousand fixes". J00Ru-Vx Tech Blog. http://j00ru.vexillium.org/?p=2211 ↩
"Search results for AddressSanitizer in FreeType Bugs". http://savannah.nongnu.org/search/?words=AddressSanitizer&type_of_search=bugs&Search=Search&exact=1#options ↩