From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16D80C433F5 for ; Thu, 23 Sep 2021 15:04:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D46536124E for ; Thu, 23 Sep 2021 15:04:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D46536124E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nCzFd9PkfybSujcSLlEz6FSb6CPlgXdvkJnFenWe9Gc=; b=R2PUg8OxnsICAK PHyo/Pw/c1h6RJGAtIbA68KSL6imyTuuyQeh7OpOTNOUDn52DC0uGNGlfCJSCZqWdzKP8VDRy2ME+ /LshsQqdVlhXOegaxiOO4zeXHKu9haN7IGNf9uBgC4GvxlNwAl5Vx1T7oga/3HLUErHoxE4kGyHKK 5Adceqg5UNvZwEu7I3jVhiAd71hR7g9EzHnEDg68RM+M5B1ydk5GQAu8InKvwC7MPj0oNxhZ1M3bf 2eijnZqxhNALXnkY7wBBUHqGdJRy/OLz1GsYSsvA0rcUeNJaBzUcUWg/X+qZmYwnpvvMb4i5P8uJc oii6nhvHrdlaxxAJeglg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTQGJ-00ByeV-Lf; Thu, 23 Sep 2021 15:03:47 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTQCX-00BwLo-69 for linux-riscv@lists.infradead.org; Thu, 23 Sep 2021 14:59:54 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F03A60FC1; Thu, 23 Sep 2021 14:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632409192; bh=88u0FgUHUX8cPCvfv9jW9Rt/RzvchoT0U9GwNmj1jp8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NHICIs3caYFBGM/yfGprZHt5bU45CHP3ScZk049PBlmwAd5Q5IIln5NPt+Zl2cFaN t7pMrCVnMm0s3LTkguNrIFsd5B35xXV0XanI1ekaqke5c7G+8Fg0nehoUk3sFDa2ts vTLW++ZKgsxxZlTKATzwbAIdSsgm7Y78T46jqSHwVa61MLEN0V+izmBDyS+w15rD1X yBgT17HMxKSnDtxpiosBOigF+SeZTw6QrefWwORlh8NRzmDepfpPaH/2R7THC28qgt bkDtLGVqJmuKFjYYnV7ZcFY+pe3rrCwmIuMZ85q9+shGYKu9e6A3hlAK+rlGAQCWQH f8ouRLX560bIw== Date: Thu, 23 Sep 2021 07:59:46 -0700 From: Nathan Chancellor To: Marco Elver , Andrew Morton Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Nick Desaulniers , Arnd Bergmann , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-riscv , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-mm@kvack.org Subject: Re: [PATCH] kasan: Always respect CONFIG_KASAN_STACK Message-ID: References: <20210922205525.570068-1-nathan@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210923_075953_285031_1DBB2D92 X-CRM114-Status: GOOD ( 24.09 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, Sep 23, 2021 at 12:07:17PM +0200, Marco Elver wrote: > On Wed, 22 Sept 2021 at 22:55, Nathan Chancellor wrote: > > Currently, the asan-stack parameter is only passed along if > > CFLAGS_KASAN_SHADOW is not empty, which requires KASAN_SHADOW_OFFSET to > > be defined in Kconfig so that the value can be checked. In RISC-V's > > case, KASAN_SHADOW_OFFSET is not defined in Kconfig, which means that > > asan-stack does not get disabled with clang even when CONFIG_KASAN_STACK > > is disabled, resulting in large stack warnings with allmodconfig: > > > > drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c:117:12: > > error: stack frame size (14400) exceeds limit (2048) in function > > 'lb035q02_connect' [-Werror,-Wframe-larger-than] > > static int lb035q02_connect(struct omap_dss_device *dssdev) > > ^ > > 1 error generated. > > > > Ensure that the value of CONFIG_KASAN_STACK is always passed along to > > the compiler so that these warnings do not happen when > > CONFIG_KASAN_STACK is disabled. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1453 > > References: 6baec880d7a5 ("kasan: turn off asan-stack for clang-8 and earlier") > > Signed-off-by: Nathan Chancellor > > Reviewed-by: Marco Elver Thanks! > [ Which tree are you planning to take it through? ] Gah, I was intending for it to go through -mm, then I cc'd neither Andrew nor linux-mm... :/ Andrew, do you want me to resend or can you grab it from LKML? > Note, arch/riscv/include/asm/kasan.h mentions KASAN_SHADOW_OFFSET in > comment (copied from arm64). Did RISC-V just forget to copy over the > Kconfig option? I do see it defined in that file as well but you are right that they did not copy the Kconfig logic, even though it was present in the tree when RISC-V KASAN was implemented. Perhaps they should so that they get access to the other flags in the "else" branch? > > --- > > scripts/Makefile.kasan | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan > > index 801c415bac59..b9e94c5e7097 100644 > > --- a/scripts/Makefile.kasan > > +++ b/scripts/Makefile.kasan > > @@ -33,10 +33,11 @@ else > > CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ > > $(call cc-param,asan-globals=1) \ > > $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ > > - $(call cc-param,asan-stack=$(stack_enable)) \ > > $(call cc-param,asan-instrument-allocas=1) > > endif > > > > +CFLAGS_KASAN += $(call cc-param,asan-stack=$(stack_enable)) > > + > > endif # CONFIG_KASAN_GENERIC > > > > ifdef CONFIG_KASAN_SW_TAGS > > > > base-commit: 4057525736b159bd456732d11270af2cc49ec21f > > -- > > 2.33.0.514.g99c99ed825 > > > > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C61F43FCB for ; Thu, 23 Sep 2021 14:59:52 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F03A60FC1; Thu, 23 Sep 2021 14:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632409192; bh=88u0FgUHUX8cPCvfv9jW9Rt/RzvchoT0U9GwNmj1jp8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NHICIs3caYFBGM/yfGprZHt5bU45CHP3ScZk049PBlmwAd5Q5IIln5NPt+Zl2cFaN t7pMrCVnMm0s3LTkguNrIFsd5B35xXV0XanI1ekaqke5c7G+8Fg0nehoUk3sFDa2ts vTLW++ZKgsxxZlTKATzwbAIdSsgm7Y78T46jqSHwVa61MLEN0V+izmBDyS+w15rD1X yBgT17HMxKSnDtxpiosBOigF+SeZTw6QrefWwORlh8NRzmDepfpPaH/2R7THC28qgt bkDtLGVqJmuKFjYYnV7ZcFY+pe3rrCwmIuMZ85q9+shGYKu9e6A3hlAK+rlGAQCWQH f8ouRLX560bIw== Date: Thu, 23 Sep 2021 07:59:46 -0700 From: Nathan Chancellor To: Marco Elver , Andrew Morton Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Nick Desaulniers , Arnd Bergmann , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-riscv , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-mm@kvack.org Subject: Re: [PATCH] kasan: Always respect CONFIG_KASAN_STACK Message-ID: References: <20210922205525.570068-1-nathan@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Sep 23, 2021 at 12:07:17PM +0200, Marco Elver wrote: > On Wed, 22 Sept 2021 at 22:55, Nathan Chancellor wrote: > > Currently, the asan-stack parameter is only passed along if > > CFLAGS_KASAN_SHADOW is not empty, which requires KASAN_SHADOW_OFFSET to > > be defined in Kconfig so that the value can be checked. In RISC-V's > > case, KASAN_SHADOW_OFFSET is not defined in Kconfig, which means that > > asan-stack does not get disabled with clang even when CONFIG_KASAN_STACK > > is disabled, resulting in large stack warnings with allmodconfig: > > > > drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c:117:12: > > error: stack frame size (14400) exceeds limit (2048) in function > > 'lb035q02_connect' [-Werror,-Wframe-larger-than] > > static int lb035q02_connect(struct omap_dss_device *dssdev) > > ^ > > 1 error generated. > > > > Ensure that the value of CONFIG_KASAN_STACK is always passed along to > > the compiler so that these warnings do not happen when > > CONFIG_KASAN_STACK is disabled. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1453 > > References: 6baec880d7a5 ("kasan: turn off asan-stack for clang-8 and earlier") > > Signed-off-by: Nathan Chancellor > > Reviewed-by: Marco Elver Thanks! > [ Which tree are you planning to take it through? ] Gah, I was intending for it to go through -mm, then I cc'd neither Andrew nor linux-mm... :/ Andrew, do you want me to resend or can you grab it from LKML? > Note, arch/riscv/include/asm/kasan.h mentions KASAN_SHADOW_OFFSET in > comment (copied from arm64). Did RISC-V just forget to copy over the > Kconfig option? I do see it defined in that file as well but you are right that they did not copy the Kconfig logic, even though it was present in the tree when RISC-V KASAN was implemented. Perhaps they should so that they get access to the other flags in the "else" branch? > > --- > > scripts/Makefile.kasan | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan > > index 801c415bac59..b9e94c5e7097 100644 > > --- a/scripts/Makefile.kasan > > +++ b/scripts/Makefile.kasan > > @@ -33,10 +33,11 @@ else > > CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ > > $(call cc-param,asan-globals=1) \ > > $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ > > - $(call cc-param,asan-stack=$(stack_enable)) \ > > $(call cc-param,asan-instrument-allocas=1) > > endif > > > > +CFLAGS_KASAN += $(call cc-param,asan-stack=$(stack_enable)) > > + > > endif # CONFIG_KASAN_GENERIC > > > > ifdef CONFIG_KASAN_SW_TAGS > > > > base-commit: 4057525736b159bd456732d11270af2cc49ec21f > > -- > > 2.33.0.514.g99c99ed825 > > > >