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