lkml.org 
[lkml]   [2015]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kasan: fix build warnings
Date
Some versions of gcc produce warning instead of error when
-fsanitize flag uses unsupported argument:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61065

This breaks our detection of whether -fsanitize=kernel-address
is supported by compiler or not. Thus we have tons of build
warnings like this:
x86_64-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'kernel-address'

Passing -Werror into $(call cc-option) will fix this problem
as gcc will error out now.

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

Hi Andrew, this patch applies on top kasan patch set.
We can't just fix add-kernel-address-sanitizer-infrastructure.patch
as patch kasan-enable-instrumentation-of-global-variables.patch
depends on it.

Let me know if your prefer to update all needed patches instead
of this fix.

scripts/Makefile.kasan | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index df302f8..72a40bb 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -5,15 +5,14 @@ else
call_threshold := 0
endif

-CFLAGS_KASAN_MINIMAL := $(call cc-option, -fsanitize=kernel-address \
- --param asan-globals=1)
+CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address --param asan-globals=1

CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
-fasan-shadow-offset=$(CONFIG_KASAN_SHADOW_OFFSET) \
--param asan-stack=1 --param asan-globals=1 \
--param asan-instrumentation-with-call-threshold=$(call_threshold))

-ifeq ($(CFLAGS_KASAN_MINIMAL),)
+ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
$(warning Cannot use CONFIG_KASAN: \
-fsanitize=kernel-address is not supported by compiler)
else
--
2.2.2


\
 
 \ /
  Last update: 2015-02-04 13:01    [W:0.117 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site