AddressSanitizer (ASan) is a fast runtime memory error detector for C/C++ that uses compiler instrumentation and shadow memory to catch heap, stack, and global out‑of‑bounds accesses, use‑after‑free, double‑free and leaks, with detailed reports and configurable options for debugging and CI.

This guide walks Linux developers and operators through the fundamentals of kernel memory management, common memory bugs, and step‑by‑step configuration and usage of KASAN—including shadow memory, compile‑time instrumentation, kernel build options, and practical code examples—to quickly locate and fix out‑of‑bounds, use‑after‑free, and leak issues.

This article explains the principles behind HWAddressSanitizer (HWASAN), how it uses the AArch64 Top‑Byte‑Ignore hardware feature to provide lower‑overhead memory error detection than ASAN, and walks through practical examples, implementation details, and LLVM integration for C/C++ developers.

This article explains the core algorithms behind AddressSanitizer, covering its shadow memory mapping, instrumentation module, runtime library, poisoned redzones, false‑negative scenarios, configurable flags, and emerging hardware‑assisted designs for memory‑error detection.

This article explains the inner workings of KernelAddressSanitizer (KASAN) in the Linux kernel, covering how to enable it, the shadow‑memory mechanism, redzone handling for heap, global and stack allocations, and how to interpret the detailed KASAN bug reports generated at runtime.

KASAN, the Kernel Address Sanitizer, is a built‑in Linux kernel tool that uses shadow memory to mark each 8‑byte block’s accessibility, enabling detection of out‑of‑bounds and use‑after‑free errors while consuming about one‑eighth of RAM and requiring kernel configuration changes to activate.
