LLVM/Clang Gets Plumbed For Kernel Memory Sanitizer
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.
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.
5 Comments