blob: 19d42ea75ec225d385734e5212680df0ef9609c6 [file] [log] [blame]
Andrey Ryabininc6d30852016-01-20 15:00:55 -08001config ARCH_HAS_UBSAN_SANITIZE_ALL
2 bool
3
Christian Borntraeger725c4d22016-09-12 14:37:19 +02004config ARCH_WANTS_UBSAN_NO_NULL
5 def_bool n
6
Andrey Ryabininc6d30852016-01-20 15:00:55 -08007config UBSAN
8 bool "Undefined behaviour sanity checker"
9 help
10 This option enables undefined behaviour sanity checker
11 Compile-time instrumentation is used to detect various undefined
12 behaviours in runtime. Various types of checks may be enabled
Andreas Platschek04625542016-12-14 15:05:43 -080013 via boot parameter ubsan_handle
14 (see: Documentation/dev-tools/ubsan.rst).
Andrey Ryabininc6d30852016-01-20 15:00:55 -080015
16config UBSAN_SANITIZE_ALL
17 bool "Enable instrumentation for the entire kernel"
18 depends on UBSAN
19 depends on ARCH_HAS_UBSAN_SANITIZE_ALL
Andrey Ryabinindde5cf32016-03-22 14:27:45 -070020
21 # We build with -Wno-maybe-uninitilzed, but we still want to
22 # use -Wmaybe-uninitilized in allmodconfig builds.
23 # So dependsy bellow used to disable this option in allmodconfig
24 depends on !COMPILE_TEST
Andrey Ryabininc6d30852016-01-20 15:00:55 -080025 default y
26 help
27 This option activates instrumentation for the entire kernel.
28 If you don't enable this option, you have to explicitly specify
29 UBSAN_SANITIZE := y for the files/directories you want to check for UB.
Yang Shi77075352016-02-11 16:12:55 -080030 Enabling this option will get kernel image size increased
31 significantly.
Andrey Ryabininc6d30852016-01-20 15:00:55 -080032
33config UBSAN_ALIGNMENT
34 bool "Enable checking of pointers alignment"
35 depends on UBSAN
36 default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS
37 help
38 This option enables detection of unaligned memory accesses.
Yang Shi77075352016-02-11 16:12:55 -080039 Enabling this option on architectures that support unaligned
Andrey Ryabininc6d30852016-01-20 15:00:55 -080040 accesses may produce a lot of false positives.
Christian Borntraeger725c4d22016-09-12 14:37:19 +020041
42config UBSAN_NULL
43 bool "Enable checking of null pointers"
44 depends on UBSAN
45 default y if !ARCH_WANTS_UBSAN_NO_NULL
46 help
47 This option enables detection of memory accesses via a
48 null pointer.
Jinbum Park854686f2018-04-10 16:32:58 -070049
50config TEST_UBSAN
51 tristate "Module for testing for undefined behavior detection"
52 depends on m && UBSAN
53 help
54 This is a test module for UBSAN.
55 It triggers various undefined behavior, and detect it.