Commit | Line | Data |
---|---|---|
0b24becc AR |
1 | config HAVE_ARCH_KASAN |
2 | bool | |
3 | ||
4 | if HAVE_ARCH_KASAN | |
5 | ||
6 | config KASAN | |
7 | bool "KASan: runtime memory debugger" | |
7ed2f9e6 | 8 | depends on SLUB_DEBUG || (SLAB && !DEBUG_SLAB) |
bebf56a1 | 9 | select CONSTRUCTORS |
0b24becc AR |
10 | help |
11 | Enables kernel address sanitizer - runtime memory debugger, | |
12 | designed to find out-of-bounds accesses and use-after-free bugs. | |
01e76903 JP |
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. | |
89d3c87e | 18 | For better error detection enable CONFIG_STACKTRACE. |
7ed2f9e6 AP |
19 | Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB |
20 | (the resulting kernel does not boot). | |
0b24becc | 21 | |
0b24becc AR |
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. | |
01e76903 | 43 | This requires a gcc version of 5.0 or later. |
0b24becc AR |
44 | |
45 | endchoice | |
46 | ||
3f15801c AR |
47 | config TEST_KASAN |
48 | tristate "Module for testing kasan for bug detection" | |
49 | depends on m && KASAN | |
50 | help | |
51 | This is a test module doing various nasty things like | |
52 | out of bounds accesses, use after free. It is useful for testing | |
53 | kernel debugging features like kernel address sanitizer. | |
54 | ||
0b24becc | 55 | endif |