Back to home page

LXR

 
 

    


0001 config HAVE_ARCH_KASAN
0002         bool
0003 
0004 if HAVE_ARCH_KASAN
0005 
0006 config KASAN
0007         bool "KASan: runtime memory debugger"
0008         depends on SLUB || (SLAB && !DEBUG_SLAB)
0009         select CONSTRUCTORS
0010         select STACKDEPOT
0011         help
0012           Enables kernel address sanitizer - runtime memory debugger,
0013           designed to find out-of-bounds accesses and use-after-free bugs.
0014           This is strictly a debugging feature and it requires a gcc version
0015           of 4.9.2 or later. Detection of out of bounds accesses to stack or
0016           global variables requires gcc 5.0 or later.
0017           This feature consumes about 1/8 of available memory and brings about
0018           ~x3 performance slowdown.
0019           For better error detection enable CONFIG_STACKTRACE.
0020           Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
0021           (the resulting kernel does not boot).
0022 
0023 choice
0024         prompt "Instrumentation type"
0025         depends on KASAN
0026         default KASAN_OUTLINE
0027 
0028 config KASAN_OUTLINE
0029         bool "Outline instrumentation"
0030         help
0031           Before every memory access compiler insert function call
0032           __asan_load*/__asan_store*. These functions performs check
0033           of shadow memory. This is slower than inline instrumentation,
0034           however it doesn't bloat size of kernel's .text section so
0035           much as inline does.
0036 
0037 config KASAN_INLINE
0038         bool "Inline instrumentation"
0039         help
0040           Compiler directly inserts code checking shadow memory before
0041           memory accesses. This is faster than outline (in some workloads
0042           it gives about x2 boost over outline instrumentation), but
0043           make kernel's .text size much bigger.
0044           This requires a gcc version of 5.0 or later.
0045 
0046 endchoice
0047 
0048 config TEST_KASAN
0049         tristate "Module for testing kasan for bug detection"
0050         depends on m && KASAN
0051         help
0052           This is a test module doing various nasty things like
0053           out of bounds accesses, use after free. It is useful for testing
0054           kernel debugging features like kernel address sanitizer.
0055 
0056 endif