Sanitizer toolset

To use a given tool, compile the program with the flag(s) shown in the Usage column:

Sanitizer tool (short name)

Purpose

Usage (compiler flags)

Linux platforms [+comments]

AddressSanitizer (ASan) Detecting generic memory errors [heap|stack|global buffer over|under-flow, UAF, UAR, init order bugs]

-fsanitize=address

x86, x86_64, ARM, Aarch64, MIPS, MIPS64, PPC64. [Cannot combine with TSan]

Kernel AddressSanitizer (KASAN) ASan for Linux kernel-space

-fsanitize=kernel-address

x86_64 [kernel ver >=4.0], Aarch64 [kernel ver >= 4.4]

MemorySanitizer (MSan) UMR detector -fsanitize=memory -fPIE -pie [-fno-omit-frame-pointer]

Linux x86_64 only

ThreadSanitizer (TSan) Data Races detector -fsanitize=thread ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.