Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 1 | config ARCH_HAS_UBSAN_SANITIZE_ALL |
| 2 | bool |
| 3 | |
Christian Borntraeger | 725c4d2 | 2016-09-12 14:37:19 +0200 | [diff] [blame] | 4 | config ARCH_WANTS_UBSAN_NO_NULL |
| 5 | def_bool n |
| 6 | |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 7 | config 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 Platschek | 0462554 | 2016-12-14 15:05:43 -0800 | [diff] [blame] | 13 | via boot parameter ubsan_handle |
| 14 | (see: Documentation/dev-tools/ubsan.rst). |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 15 | |
| 16 | config UBSAN_SANITIZE_ALL |
| 17 | bool "Enable instrumentation for the entire kernel" |
| 18 | depends on UBSAN |
| 19 | depends on ARCH_HAS_UBSAN_SANITIZE_ALL |
Andrey Ryabinin | dde5cf3 | 2016-03-22 14:27:45 -0700 | [diff] [blame] | 20 | |
| 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 Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 25 | 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 Shi | 7707535 | 2016-02-11 16:12:55 -0800 | [diff] [blame] | 30 | Enabling this option will get kernel image size increased |
| 31 | significantly. |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 32 | |
| 33 | config 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 Shi | 7707535 | 2016-02-11 16:12:55 -0800 | [diff] [blame] | 39 | Enabling this option on architectures that support unaligned |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 40 | accesses may produce a lot of false positives. |
Christian Borntraeger | 725c4d2 | 2016-09-12 14:37:19 +0200 | [diff] [blame] | 41 | |
| 42 | config 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. |