LLVM/Clang Gets Plumbed For Kernel Memory Sanitizer

Written by Michael Larabel in LLVM on 7 September 2018 at 05:55 AM EDT. 5 Comments
LLVM
The latest "sanitizer" worked on by Google's developers for the LLVM/Clang compiler infrastructure is a Kernel Memory Sanitizer (KMSAN).

KMSAN is a special sanitizer compared to the conventional Memory Sanitizer pass that is just focused on kernel memory. Currently this new LLVM pass just supports the Linux x86_64 kernel. Those unfamiliar with the existing MemorySanitizer functionality that already lives within LLVM can see the documentation on this pass.

Some of the technical differences to KernelMemorySanitizer compared to the standard MemorySanitizer are outlined by this commit introducing the new capability to LLVM 8 trunk.

This functionality is then exposed up through Clang as of this commit today with the -fsanitize=kernel-memory compiler switch.

The memory sanitizer is useful for catching issues like uninitialized reads, but does introduce a significant performance penalty as well as increased memory consumption that makes it only practical for debug-type builds. There are also the various other sanitizers that have been developed by Google like AddressSanitizer, ThreadSanitizer, and UndefinedBehaviorSanitizer. Hopefully this KernelMemorySanitizer addition will be useful for catching some new kernel memory bugs in short-order.
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