diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-09-12 08:37:19 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-09-20 08:26:08 -0400 |
commit | 725c4d22bbc4fcac5779963e0ff9cdf232afbb90 (patch) | |
tree | aa31d4784fc88800c8c26d18ecf90efa59480ee2 | |
parent | f296190e41ee1e1e6912f0ddae09b28e9cfae48d (diff) |
ubsan: allow to disable the null sanitizer
Some architectures use a hardware defined structure at address zero.
Checking for a null pointer will result in many ubsan reports.
Allow users to disable the null sanitizer.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | lib/Kconfig.ubsan | 11 | ||||
-rw-r--r-- | scripts/Makefile.ubsan | 5 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 39494af9a84a..bc6e651df68c 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan | |||
@@ -1,6 +1,9 @@ | |||
1 | config ARCH_HAS_UBSAN_SANITIZE_ALL | 1 | config ARCH_HAS_UBSAN_SANITIZE_ALL |
2 | bool | 2 | bool |
3 | 3 | ||
4 | config ARCH_WANTS_UBSAN_NO_NULL | ||
5 | def_bool n | ||
6 | |||
4 | config UBSAN | 7 | config UBSAN |
5 | bool "Undefined behaviour sanity checker" | 8 | bool "Undefined behaviour sanity checker" |
6 | help | 9 | help |
@@ -34,3 +37,11 @@ config UBSAN_ALIGNMENT | |||
34 | This option enables detection of unaligned memory accesses. | 37 | This option enables detection of unaligned memory accesses. |
35 | Enabling this option on architectures that support unaligned | 38 | Enabling this option on architectures that support unaligned |
36 | accesses may produce a lot of false positives. | 39 | accesses may produce a lot of false positives. |
40 | |||
41 | config UBSAN_NULL | ||
42 | bool "Enable checking of null pointers" | ||
43 | depends on UBSAN | ||
44 | default y if !ARCH_WANTS_UBSAN_NO_NULL | ||
45 | help | ||
46 | This option enables detection of memory accesses via a | ||
47 | null pointer. | ||
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index 8ab68679cfb5..dd779c40c8e6 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan | |||
@@ -3,7 +3,6 @@ ifdef CONFIG_UBSAN | |||
3 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=integer-divide-by-zero) | 3 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=integer-divide-by-zero) |
4 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=unreachable) | 4 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=unreachable) |
5 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=vla-bound) | 5 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=vla-bound) |
6 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=null) | ||
7 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=signed-integer-overflow) | 6 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=signed-integer-overflow) |
8 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) | 7 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) |
9 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size) | 8 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size) |
@@ -14,4 +13,8 @@ ifdef CONFIG_UBSAN | |||
14 | ifdef CONFIG_UBSAN_ALIGNMENT | 13 | ifdef CONFIG_UBSAN_ALIGNMENT |
15 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment) | 14 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment) |
16 | endif | 15 | endif |
16 | |||
17 | ifdef CONFIG_UBSAN_NULL | ||
18 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=null) | ||
19 | endif | ||
17 | endif | 20 | endif |