OSDN Git Service

Merge "ARM: dts: msm: Add support for complete subsystem ramdump for SDM660"
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / lib / Kconfig.kasan
1 config HAVE_ARCH_KASAN
2         bool
3
4 if HAVE_ARCH_KASAN
5
6 config KASAN
7         bool "KASan: runtime memory debugger"
8         depends on SLUB || (SLAB && !DEBUG_SLAB)
9         select CONSTRUCTORS
10         select STACKDEPOT
11         help
12           Enables kernel address sanitizer - runtime memory debugger,
13           designed to find out-of-bounds accesses and use-after-free bugs.
14           This is strictly a debugging feature and it requires a gcc version
15           of 4.9.2 or later. Detection of out of bounds accesses to stack or
16           global variables requires gcc 5.0 or later.
17           This feature consumes about 1/8 of available memory and brings about
18           ~x3 performance slowdown.
19           For better error detection enable CONFIG_STACKTRACE.
20           See KASAN_SANITIZE_ALL for selectively compiling files and directories
21           with this compiler feature enabled.
22           Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
23           (the resulting kernel does not boot).
24
25 choice
26         prompt "Instrumentation type"
27         depends on KASAN
28         default KASAN_OUTLINE
29
30 config KASAN_OUTLINE
31         bool "Outline instrumentation"
32         help
33           Before every memory access compiler insert function call
34           __asan_load*/__asan_store*. These functions performs check
35           of shadow memory. This is slower than inline instrumentation,
36           however it doesn't bloat size of kernel's .text section so
37           much as inline does.
38
39 config KASAN_INLINE
40         bool "Inline instrumentation"
41         help
42           Compiler directly inserts code checking shadow memory before
43           memory accesses. This is faster than outline (in some workloads
44           it gives about x2 boost over outline instrumentation), but
45           make kernel's .text size much bigger.
46           This requires a gcc version of 5.0 or later.
47
48 endchoice
49
50 config KASAN_SANITIZE_ALL
51         bool "KASan: Enable Instrumentation for entire kernel"
52         depends on KASAN
53         default y
54         help
55           Enable compilation with $(CFLAGS_KASAN) by default.
56           KASAN_SANITIZE := n - exclude all files in a directory
57           KASAN_SANITIZE_file_name.o := n - exclude a single file
58           Setting KASAN_SANITIZE_ALL to 'n' allows enabling kasan in
59           only certain files or directories.
60           KASAN_SANITIZE := y - include all files in a directory
61           KASAN_SANITIZE_file_name.o := y - include single file
62
63           KASAN_SANITIZE does not affect subdirectories.
64           KASAN_SANITIZE_file_name.o has priority over KASAN_SANITIZE.
65
66 config TEST_KASAN
67         tristate "Module for testing kasan for bug detection"
68         depends on m && KASAN
69         help
70           This is a test module doing various nasty things like
71           out of bounds accesses, use after free. It is useful for testing
72           kernel debugging features like kernel address sanitizer.
73
74 endif