Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 1 | config ARCH_HAS_UBSAN_SANITIZE_ALL |
| 2 | bool |
| 3 | |
| 4 | config UBSAN |
| 5 | bool "Undefined behaviour sanity checker" |
| 6 | help |
| 7 | This option enables undefined behaviour sanity checker |
| 8 | Compile-time instrumentation is used to detect various undefined |
| 9 | behaviours in runtime. Various types of checks may be enabled |
Andreas Platschek | 0462554 | 2016-12-14 15:05:43 -0800 | [diff] [blame] | 10 | via boot parameter ubsan_handle |
| 11 | (see: Documentation/dev-tools/ubsan.rst). |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 12 | |
| 13 | config UBSAN_SANITIZE_ALL |
| 14 | bool "Enable instrumentation for the entire kernel" |
| 15 | depends on UBSAN |
| 16 | depends on ARCH_HAS_UBSAN_SANITIZE_ALL |
Andrey Ryabinin | dde5cf3 | 2016-03-22 14:27:45 -0700 | [diff] [blame] | 17 | |
| 18 | # We build with -Wno-maybe-uninitilzed, but we still want to |
| 19 | # use -Wmaybe-uninitilized in allmodconfig builds. |
| 20 | # So dependsy bellow used to disable this option in allmodconfig |
| 21 | depends on !COMPILE_TEST |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 22 | default y |
| 23 | help |
| 24 | This option activates instrumentation for the entire kernel. |
| 25 | If you don't enable this option, you have to explicitly specify |
| 26 | 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] | 27 | Enabling this option will get kernel image size increased |
| 28 | significantly. |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 29 | |
| 30 | config UBSAN_ALIGNMENT |
| 31 | bool "Enable checking of pointers alignment" |
| 32 | depends on UBSAN |
| 33 | default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS |
| 34 | help |
| 35 | This option enables detection of unaligned memory accesses. |
Yang Shi | 7707535 | 2016-02-11 16:12:55 -0800 | [diff] [blame] | 36 | Enabling this option on architectures that support unaligned |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 37 | accesses may produce a lot of false positives. |
Christian Borntraeger | 725c4d2 | 2016-09-12 14:37:19 +0200 | [diff] [blame] | 38 | |
Jinbum Park | 854686f | 2018-04-10 16:32:58 -0700 | [diff] [blame] | 39 | config TEST_UBSAN |
| 40 | tristate "Module for testing for undefined behavior detection" |
| 41 | depends on m && UBSAN |
| 42 | help |
| 43 | This is a test module for UBSAN. |
| 44 | It triggers various undefined behavior, and detect it. |