Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ubsan/overflow: Enable pattern exclusions

To make integer wrap-around mitigation actually useful, the associated
sanitizers must not instrument cases where the wrap-around is explicitly
defined (e.g. "-2UL"), being tested for (e.g. "if (a + b < a)"), or
where it has no impact on code flow (e.g. "while (var--)"). Enable
pattern exclusions for the integer wrap sanitizers.

Reviewed-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20250307041914.937329-2-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>

+2
+1
lib/Kconfig.ubsan
··· 120 120 bool "Perform checking for integer arithmetic wrap-around" 121 121 default UBSAN 122 122 depends on !COMPILE_TEST 123 + depends on $(cc-option,-fsanitize-undefined-ignore-overflow-pattern=all) 123 124 depends on $(cc-option,-fsanitize=signed-integer-overflow) 124 125 depends on $(cc-option,-fsanitize=unsigned-integer-overflow) 125 126 depends on $(cc-option,-fsanitize=implicit-signed-integer-truncation)
+1
scripts/Makefile.ubsan
··· 15 15 export CFLAGS_UBSAN := $(ubsan-cflags-y) 16 16 17 17 ubsan-integer-wrap-cflags-$(CONFIG_UBSAN_INTEGER_WRAP) += \ 18 + -fsanitize-undefined-ignore-overflow-pattern=all \ 18 19 -fsanitize=signed-integer-overflow \ 19 20 -fsanitize=unsigned-integer-overflow \ 20 21 -fsanitize=implicit-signed-integer-truncation \