KernelASan: Bringing Address Sanitizer To The Linux Kernel

Written by Michael Larabel in Linux Kernel on 18 July 2014 at 09:23 AM EDT. 7 Comments
LINUX KERNEL
Work being done by Samsung and other Linux stakeholders is bringing the Address Sanitizer capabilities found in GCC as being useful for detecting potential memory issues within the Linux kernel.

Address Sanitizer is the feature within GCC (and now LLVM/Clang too) for detecting memory corruption bugs like buffer overflows, use-after-free, and other memory errors. Address Sanitizer is successfully used in the real world for finding bugs within Firefox, Chromium, FFmpeg, and many other projects for using this easy memory detection instrumentation within the compiler.

Earlier this month a set of patches were published for supporting the Address Sanitizer for the Linux kernel and introducing new CONFIG_KASAN=y and CONFIG_KASAN_SANITIZE_ALL=y kernel config options. The patches for the kernel currently support finding use-after-free bugs and out-of-bounds read/writes in kmalloc. Not yet wired in but possible to implement for the kernel memory checking code are global buffer overflows, stack buffer overflows, and use after returns.

While these patches aren't yet feature complete, there's already been a number of bugs fixed by Address Sanitizer for the kernel ranging from IPv4/IPv6 code to the EXT4 file-system and AIO. The current kernel patches can be found on the LKML and hopefully they'll get queued up for the Linux 3.17 kernel merge window.

Published today is a small GCC patch for supporting the Kernel Address Sanitizer.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week