[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200615231529.GA119644@google.com>
Date: Tue, 16 Jun 2020 01:15:29 +0200
From: Marco Elver <elver@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: kernel test robot <lkp@...el.com>, kbuild-all@...ts.01.org,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] compiler_attributes.h: Support no_sanitize_undefined check
with GCC 4
UBSAN is supported since GCC 4.9, which unfortunately did not yet have
__has_attribute(). To work around, the __GCC4_has_attribute workaround
requires defining which compiler version supports the given attribute.
In the case of no_sanitize_undefined, it is the first version that
supports UBSAN, which is GCC 4.9.
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Marco Elver <elver@...gle.com>
---
Doing a 'make W=1' with GCC 4.9 and the provided config fixes the build
robot's report.
Peter: Feel free to either squash this patch into the one adding
__no_sanitize_undefined or apply on top.
Although at this point we don't have any users of
__no_sanitize_undefined anymore since objtool resolved the noinstr
problem for UBSAN differently. We should probably keep the attribute
around because eventually somebody will need it.
Thanks,
-- Marco
---
include/linux/compiler_attributes.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
index cdf016596659..c8f03d2969df 100644
--- a/include/linux/compiler_attributes.h
+++ b/include/linux/compiler_attributes.h
@@ -40,6 +40,7 @@
# define __GCC4_has_attribute___noclone__ 1
# define __GCC4_has_attribute___nonstring__ 0
# define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8)
+# define __GCC4_has_attribute___no_sanitize_undefined__ (__GNUC_MINOR__ >= 9)
# define __GCC4_has_attribute___fallthrough__ 0
#endif
--
2.27.0.290.gba653c62da-goog
Powered by blists - more mailing lists