LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* linux-next: build failure after merge of the akpm-current tree
@ 2015-02-04  7:53 Stephen Rothwell
  2015-02-04 11:43 ` [PATCH] kasan: fix build warnings Andrey Ryabinin
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2015-02-04  7:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-next, linux-kernel, Andrey Ryabinin

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (x86-64
allmodconfig) failed like this:

scripts/Makefile.kasan:21: CONFIG_KASAN: compiler does not support all options. Trying minimal configuration
scripts/Makefile.kasan:21: CONFIG_KASAN: compiler does not support all options. Trying minimal configuration
x86_64-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'kernel-address'

lots and lots of this last message ...

Caused by the commits that added the kernel address sanitizer.

gcc version 4.9.0 cross compiling from Powerpc64.

I have added the following patch for today (after which I only got one
of the "compiler does not support all options" messages).

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 4 Feb 2015 18:43:52 +1100
Subject: [PATCH] disable CONFIG_KASAN for now

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 lib/Kconfig.kasan | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 4fecaedc80a2..4301bb56e3ce 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -1,7 +1,7 @@
 config HAVE_ARCH_KASAN
 	bool
 
-if HAVE_ARCH_KASAN
+if HAVE_ARCH_KASAN && BROKEN
 
 config KASAN
 	bool "KASan: runtime memory debugger"
-- 
2.1.4

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] kasan: fix build warnings
  2015-02-04  7:53 linux-next: build failure after merge of the akpm-current tree Stephen Rothwell
@ 2015-02-04 11:43 ` Andrey Ryabinin
  2015-02-04 12:05   ` Andrey Ryabinin
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Ryabinin @ 2015-02-04 11:43 UTC (permalink / raw)
  To: Andrew Morton, Stephen Rothwell; +Cc: linux-next, linux-kernel, Andrey Ryabinin

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kasan: fix build warnings
  2015-02-04 11:43 ` [PATCH] kasan: fix build warnings Andrey Ryabinin
@ 2015-02-04 12:05   ` Andrey Ryabinin
  2015-02-04 12:23     ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Ryabinin @ 2015-02-04 12:05 UTC (permalink / raw)
  To: Andrew Morton, Stephen Rothwell
  Cc: linux-next, open list, Michal Marek, linux-kbuild

On 02/04/2015 02:43 PM, Andrey Ryabinin wrote:
> 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
> 


Or maybe it would be be better always use -Werror in cc-option?

---
From: Andrey Ryabinin <a.ryabinin@samsung.com>
Subject: [PATCH] kbuild: always use -Werror in 'call cc-option'

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'

To workaround this compiler bug we could always use -Werror
with 'call cc-option' forcing gcc to produce error instead of
warnings.

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Michal Marek <mmarek@suse.cz>
---
 scripts/Kbuild.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index d3437b8..6bc4e3e 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -111,12 +111,12 @@ as-instr = $(call try-run,\
 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)

 cc-option = $(call try-run,\
-	$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+	$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -Werror -c -x c /dev/null -o "$$TMP",$(1),$(2))

 # cc-option-yn
 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
 cc-option-yn = $(call try-run,\
-	$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
+	$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -Werror -c -x c /dev/null -o "$$TMP",y,n)

 # cc-option-align
 # Prefix align with either -falign or -malign


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kasan: fix build warnings
  2015-02-04 12:05   ` Andrey Ryabinin
@ 2015-02-04 12:23     ` Michal Marek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2015-02-04 12:23 UTC (permalink / raw)
  To: Andrey Ryabinin, Andrew Morton, Stephen Rothwell
  Cc: linux-next, open list, linux-kbuild

On 2015-02-04 13:05, Andrey Ryabinin wrote:
> Or maybe it would be be better always use -Werror in cc-option?

Please don't do it. A couple of Makefiles call cc-option after we have
added the user-supplied KCFLAGS to KBUILD_CFLAGS.

Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-04 12:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04  7:53 linux-next: build failure after merge of the akpm-current tree Stephen Rothwell
2015-02-04 11:43 ` [PATCH] kasan: fix build warnings Andrey Ryabinin
2015-02-04 12:05   ` Andrey Ryabinin
2015-02-04 12:23     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).