From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755411AbbBDMFi (ORCPT ); Wed, 4 Feb 2015 07:05:38 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:20642 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbbBDMFg (ORCPT ); Wed, 4 Feb 2015 07:05:36 -0500 X-AuditID: cbfec7f4-b7f126d000001e9a-0d-54d20a7cdccf Message-id: <54D20B08.7010508@samsung.com> Date: Wed, 04 Feb 2015 15:05:28 +0300 From: Andrey Ryabinin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-version: 1.0 To: Andrew Morton , Stephen Rothwell Cc: linux-next@vger.kernel.org, open list , Michal Marek , linux-kbuild@vger.kernel.org Subject: Re: [PATCH] kasan: fix build warnings References: <20150204185328.1ee3ce3c@canb.auug.org.au> <1423050231-1701-1-git-send-email-a.ryabinin@samsung.com> In-reply-to: <1423050231-1701-1-git-send-email-a.ryabinin@samsung.com> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrILMWRmVeSWpSXmKPExsVy+t/xa7o1XJdCDHpmalvMWb+GzeLPrh1M Fpd3zWGzOLiwjdGiZd8FJoute6+yO7B5NN64weZxYsZvFo8zC46we3zeJBfAEsVlk5Kak1mW WqRvl8CV8WqSSMED2Yolz/czNjA+kehi5OSQEDCRmL9vDxOELSZx4d56ti5GLg4hgaWMEneP HGGHcJqZJPZ9ecAOUsUroCVx++4UsA4WAVWJB0c+sYDYbAJ6Ev9mbWcDsUUFIiQ+rPrKBlEv KPFj8j2wGhGg+PlN68HizALtjBKfG+NBbGGg3s27n4DNFBIokji/fA4ziM0p4CYxsfcxUC8H UL26xJQpuRCt8hKb17xlnsAoMAvJhlkIVbOQVC1gZF7FKJpamlxQnJSea6hXnJhbXJqXrpec n7uJERLMX3YwLj5mdYhRgINRiYe3oe1iiBBrYllxZe4hRgkOZiUR3m0cl0KEeFMSK6tSi/Lj i0pzUosPMTJxcEo1ME5Jbeq5a5YSFW6bckiDJUTkWn3j14T9y+/ODtDujjl2jI/94vQrvJ2H HsxoXsSf+OevifiGyoQ5Vcc/LXJwFwmZ9LCpaTKf7y6jy38YJiV2ypib8xrsNXxfyPpXWlzZ o3Jv88eJE/QYJinYzfMyitvCwaPmsOf5QZ7HIbGOe/hPxc+Zu/lWthJLcUaioRZzUXEiAKjq Q0hEAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Reported-by: Stephen Rothwell > --- > > 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 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 Reported-by: Stephen Rothwell Cc: Michal Marek --- 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