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. |
Joe Perches | 01e7690 | 2015-05-05 16:23:38 -0700 | [diff] [blame] | 13 | This is strictly a debugging feature and it requires a gcc version |
| 14 | of 4.9.2 or later. Detection of out of bounds accesses to stack or |
| 15 | global variables requires gcc 5.0 or later. |
| 16 | This feature consumes about 1/8 of available memory and brings about |
| 17 | ~x3 performance slowdown. |
Andrey Ryabinin | 89d3c87 | 2015-11-05 18:51:23 -0800 | [diff] [blame] | 18 | For better error detection enable CONFIG_STACKTRACE. |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 19 | |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 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. |
Joe Perches | 01e7690 | 2015-05-05 16:23:38 -0700 | [diff] [blame] | 41 | This requires a gcc version of 5.0 or later. |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 42 | |
| 43 | endchoice |
| 44 | |
Andrey Ryabinin | 3f15801 | 2015-02-13 14:39:53 -0800 | [diff] [blame] | 45 | config TEST_KASAN |
| 46 | tristate "Module for testing kasan for bug detection" |
| 47 | depends on m && KASAN |
| 48 | help |
| 49 | This is a test module doing various nasty things like |
| 50 | out of bounds accesses, use after free. It is useful for testing |
| 51 | kernel debugging features like kernel address sanitizer. |
| 52 | |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 53 | endif |