[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201002221527.177500-4-keescook@chromium.org>
Date: Fri, 2 Oct 2020 15:15:26 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ard Biesheuvel <ardb@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nathan Chancellor <natechancellor@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Marco Elver <elver@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
George Popescu <georgepope@...roid.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
clang-built-linux@...glegroups.com, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/4] ubsan: Force -Wno-maybe-uninitialized only for GCC
Clang handles 'maybe-uninitialized' better in the face of using UBSAN,
so do not make this universally disabled for UBSAN builds.
Signed-off-by: Kees Cook <keescook@...omium.org>
---
lib/Kconfig.ubsan | 6 ++++++
scripts/Makefile.ubsan | 6 +++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index aeb2cdea0b94..1fc07f936e06 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -36,6 +36,12 @@ config UBSAN_KCOV_BROKEN
See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status
in newer releases.
+config UBSAN_DISABLE_MAYBE_UNINITIALIZED
+ def_bool CC_IS_GCC
+ help
+ -fsanitize=* options makes GCC less smart than usual and
+ increases the number of 'maybe-uninitialized' false-positives.
+
config CC_HAS_UBSAN_BOUNDS
def_bool $(cc-option,-fsanitize=bounds)
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
index 72862da47baf..c5ef6bac09d4 100644
--- a/scripts/Makefile.ubsan
+++ b/scripts/Makefile.ubsan
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
-# -fsanitize=* options makes GCC less smart than usual and
-# increases the number of 'maybe-uninitialized' false-positives.
-ubsan-cflags-$(CONFIG_UBSAN) += $(call cc-disable-warning, maybe-uninitialized)
+# The "maybe-uninitialized" warning can be very noisy.
+ubsan-cflags-$(CONFIG_UBSAN_DISABLE_MAYBE_UNINITIALIZED) += \
+ $(call cc-disable-warning, maybe-uninitialized)
# Enable available and selected UBSAN features.
ubsan-cflags-$(CONFIG_UBSAN_ALIGNMENT) += -fsanitize=alignment
--
2.25.1
Powered by blists - more mailing lists