Clang changed the way it enables UBSan trapping mode. Update the Makefile
logic to discover it.

Suggested-by: Fangrui Song <mask...@google.com>
Link: 
https://lore.kernel.org/lkml/cafp8o3jivzh+aav7n90nk7u2bhrnst6mrp0zhtfq-vj0m4+...@mail.gmail.com/
Reviewed-by: Fangrui Song <mask...@google.com>
Reviewed-by: Justin Stitt <justinst...@google.com>
Cc: Nathan Chancellor <nat...@kernel.org>
Cc: Masahiro Yamada <masahi...@kernel.org>
Cc: Nicolas Schier <nico...@fjasle.eu>
Cc: Nick Desaulniers <ndesaulni...@google.com>
Cc: Bill Wendling <mo...@google.com>
Cc: linux-kbu...@vger.kernel.org
Cc: l...@lists.linux.dev
Signed-off-by: Kees Cook <keesc...@chromium.org>
---
 scripts/Makefile.ubsan | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
index 4749865c1b2c..7cf42231042b 100644
--- a/scripts/Makefile.ubsan
+++ b/scripts/Makefile.ubsan
@@ -10,6 +10,6 @@ ubsan-cflags-$(CONFIG_UBSAN_DIV_ZERO)         += 
-fsanitize=integer-divide-by-zero
 ubsan-cflags-$(CONFIG_UBSAN_UNREACHABLE)       += -fsanitize=unreachable
 ubsan-cflags-$(CONFIG_UBSAN_BOOL)              += -fsanitize=bool
 ubsan-cflags-$(CONFIG_UBSAN_ENUM)              += -fsanitize=enum
-ubsan-cflags-$(CONFIG_UBSAN_TRAP)              += 
-fsanitize-undefined-trap-on-error
+ubsan-cflags-$(CONFIG_UBSAN_TRAP)              += $(call 
cc-option,-fsanitize-trap=undefined,-fsanitize-undefined-trap-on-error)
 
 export CFLAGS_UBSAN := $(ubsan-cflags-y)
-- 
2.34.1


Reply via email to