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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A009AC4332F for ; Thu, 14 Oct 2021 18:31:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1609261037 for ; Thu, 14 Oct 2021 18:31:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1609261037 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 88062900003; Thu, 14 Oct 2021 14:31:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8307B900002; Thu, 14 Oct 2021 14:31:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F7FA900003; Thu, 14 Oct 2021 14:31:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 62FBF900002 for ; Thu, 14 Oct 2021 14:31:09 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1B93F18027466 for ; Thu, 14 Oct 2021 18:31:09 +0000 (UTC) X-FDA: 78695885058.24.3CA4ACD Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by imf06.hostedemail.com (Postfix) with ESMTP id DAED4801AB0F for ; Thu, 14 Oct 2021 18:31:07 +0000 (UTC) Received: (Authenticated sender: alex@ghiti.fr) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 9666D1BF205; Thu, 14 Oct 2021 18:31:00 +0000 (UTC) Subject: Re: [PATCH] kasan: Always respect CONFIG_KASAN_STACK To: Nathan Chancellor , Palmer Dabbelt Cc: elver@google.com, akpm@linux-foundation.org, ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com, dvyukov@google.com, ndesaulniers@google.com, Arnd Bergmann , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Paul Walmsley , aou@eecs.berkeley.edu, linux-mm@kvack.org References: From: Alex Ghiti Message-ID: Date: Thu, 14 Oct 2021 20:31:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr X-Rspamd-Queue-Id: DAED4801AB0F X-Stat-Signature: ss9s635zrw8bp9mt9k5rhx6x8dkwjged Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=none (imf06.hostedemail.com: domain of alex@ghiti.fr has no SPF policy when checking 217.70.183.201) smtp.mailfrom=alex@ghiti.fr X-Rspamd-Server: rspam02 X-HE-Tag: 1634236267-391260 Content-Transfer-Encoding: quoted-printable 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: Hi Nathan, Le 14/10/2021 =C3=A0 18:55, Nathan Chancellor a =C3=A9crit=C2=A0: > On Fri, Oct 08, 2021 at 11:46:55AM -0700, Palmer Dabbelt wrote: >> On Thu, 23 Sep 2021 07:59:46 PDT (-0700), nathan@kernel.org wrote: >>> 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_OFFSE= T 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 th= at >>>>> 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 a= nd 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? >> >> Acked-by: Palmer Dabbelt >> >> (assuming you still want it through somewhere else) >=20 > Thanks, it is now in mainline as commit 19532869feb9 ("kasan: always > respect CONFIG_KASAN_STACK"). >=20 >>>> 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 wh= en >>> RISC-V KASAN was implemented. Perhaps they should so that they get >>> access to the other flags in the "else" branch? >> >> Ya, looks like we just screwed this up. I'm seeing some warnings like >> >> cc1: warning: =E2=80=98-fsanitize=3Dkernel-address=E2=80=99 with s= tack protection is not supported without =E2=80=98-fasan-shadow-offset=3D= =E2=80=99 for this target >=20 > Hmmm, I thought I did a GCC build with this change but I must not have > :/ >=20 >> which is how I ended up here, I'm assuming that's what you're talking = about >> here? LMK if you were planning on sending along a fix or if you want = me to >> go figure it out. >=20 > I took a look at moving the logic into Kconfig like arm64 before sendin= g > this change and I did not really understand it well enough to do so. I > think it would be best if you were able to do that so that nothing gets > messed up. >=20 I'll do it tomorrow, I'm the last one who touched kasan on riscv :) Thanks, Alex > Cheers, > Nathan >=20 > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >=20