KernelASan: Bringing Address Sanitizer To The 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.
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.
7 Comments