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" |
Andrey Ryabinin | 0316bec | 2015-02-13 14:39:42 -0800 | [diff] [blame] | 8 | depends on SLUB_DEBUG |
Andrey Ryabinin | bebf56a | 2015-02-13 14:40:17 -0800 | [diff] [blame] | 9 | select CONSTRUCTORS |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 10 | help |
| 11 | Enables kernel address sanitizer - runtime memory debugger, |
| 12 | designed to find out-of-bounds accesses and use-after-free bugs. |
| 13 | This is strictly debugging feature. It consumes about 1/8 |
| 14 | of available memory and brings about ~x3 performance slowdown. |
| 15 | For better error detection enable CONFIG_STACKTRACE, |
| 16 | and add slub_debug=U to boot cmdline. |
| 17 | |
| 18 | config KASAN_SHADOW_OFFSET |
| 19 | hex |
Andrey Ryabinin | ef7f0d6 | 2015-02-13 14:39:25 -0800 | [diff] [blame] | 20 | default 0xdffffc0000000000 if X86_64 |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 21 | |
| 22 | choice |
| 23 | prompt "Instrumentation type" |
| 24 | depends on KASAN |
| 25 | default KASAN_OUTLINE |
| 26 | |
| 27 | config KASAN_OUTLINE |
| 28 | bool "Outline instrumentation" |
| 29 | help |
| 30 | Before every memory access compiler insert function call |
| 31 | __asan_load*/__asan_store*. These functions performs check |
| 32 | of shadow memory. This is slower than inline instrumentation, |
| 33 | however it doesn't bloat size of kernel's .text section so |
| 34 | much as inline does. |
| 35 | |
| 36 | config KASAN_INLINE |
| 37 | bool "Inline instrumentation" |
| 38 | help |
| 39 | Compiler directly inserts code checking shadow memory before |
| 40 | memory accesses. This is faster than outline (in some workloads |
| 41 | it gives about x2 boost over outline instrumentation), but |
| 42 | make kernel's .text size much bigger. |
| 43 | |
| 44 | endchoice |
| 45 | |
Andrey Ryabinin | 3f15801 | 2015-02-13 14:39:53 -0800 | [diff] [blame] | 46 | config TEST_KASAN |
| 47 | tristate "Module for testing kasan for bug detection" |
| 48 | depends on m && KASAN |
| 49 | help |
| 50 | This is a test module doing various nasty things like |
| 51 | out of bounds accesses, use after free. It is useful for testing |
| 52 | kernel debugging features like kernel address sanitizer. |
| 53 | |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 54 | endif |