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=-22.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 7B712C4332F for ; Thu, 23 Sep 2021 14:59:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 049E46124D for ; Thu, 23 Sep 2021 14:59:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 049E46124D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3E9AF6B006C; Thu, 23 Sep 2021 10:59:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 398A36B0071; Thu, 23 Sep 2021 10:59:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2871E6B0072; Thu, 23 Sep 2021 10:59:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id 1998A6B006C for ; Thu, 23 Sep 2021 10:59:54 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B6BCA8249980 for ; Thu, 23 Sep 2021 14:59:53 +0000 (UTC) X-FDA: 78619147866.37.532CC6D Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id 64867F0000B4 for ; Thu, 23 Sep 2021 14:59:53 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 64867F0000B4 X-Stat-Signature: bmsb6s3gp3a1kdx3up9znop3rxomte99 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NHICIs3c; spf=pass (imf11.hostedemail.com: domain of nathan@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=nathan@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1632409193-80090 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > > > >