Skip to content

Commit 77fcc34

Browse files
committed
ubsan: Disable signed integer overflow sanitizer on GCC < 8
For opting functions out of sanitizer coverage, the "no_sanitize" attribute is used, but in GCC this wasn't introduced until GCC 8. Disable the sanitizer unless we're not using GCC, or it is GCC version 8 or higher. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202403110643.27JXEVCI-lkp@intel.com/ Reviewed-by: Marco Elver <elver@google.com> Signed-off-by: Kees Cook <keescook@chromium.org>
1 parent 0a7b0ac commit 77fcc34

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/Kconfig.ubsan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ config UBSAN_SIGNED_WRAP
119119
bool "Perform checking for signed arithmetic wrap-around"
120120
default UBSAN
121121
depends on !COMPILE_TEST
122+
# The no_sanitize attribute was introduced in GCC with version 8.
123+
depends on !CC_IS_GCC || GCC_VERSION >= 80000
122124
depends on $(cc-option,-fsanitize=signed-integer-overflow)
123125
help
124126
This option enables -fsanitize=signed-integer-overflow which checks

0 commit comments

Comments
 (0)