Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 1 | config HAVE_ARCH_KASAN |
| 2 | bool |
| 3 | |
| 4 | if HAVE_ARCH_KASAN |
| 5 | |
| 6 | config KASAN |
| 7 | bool "KASan: runtime memory debugger" |
| 8 | help |
| 9 | Enables kernel address sanitizer - runtime memory debugger, |
| 10 | designed to find out-of-bounds accesses and use-after-free bugs. |
| 11 | This is strictly debugging feature. It consumes about 1/8 |
| 12 | of available memory and brings about ~x3 performance slowdown. |
| 13 | For better error detection enable CONFIG_STACKTRACE, |
| 14 | and add slub_debug=U to boot cmdline. |
| 15 | |
| 16 | config KASAN_SHADOW_OFFSET |
| 17 | hex |
Andrey Ryabinin | ef7f0d6 | 2015-02-13 14:39:25 -0800 | [diff] [blame^] | 18 | default 0xdffffc0000000000 if X86_64 |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 19 | |
| 20 | choice |
| 21 | prompt "Instrumentation type" |
| 22 | depends on KASAN |
| 23 | default KASAN_OUTLINE |
| 24 | |
| 25 | config KASAN_OUTLINE |
| 26 | bool "Outline instrumentation" |
| 27 | help |
| 28 | Before every memory access compiler insert function call |
| 29 | __asan_load*/__asan_store*. These functions performs check |
| 30 | of shadow memory. This is slower than inline instrumentation, |
| 31 | however it doesn't bloat size of kernel's .text section so |
| 32 | much as inline does. |
| 33 | |
| 34 | config KASAN_INLINE |
| 35 | bool "Inline instrumentation" |
| 36 | help |
| 37 | Compiler directly inserts code checking shadow memory before |
| 38 | memory accesses. This is faster than outline (in some workloads |
| 39 | it gives about x2 boost over outline instrumentation), but |
| 40 | make kernel's .text size much bigger. |
| 41 | |
| 42 | endchoice |
| 43 | |
| 44 | endif |