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 AB416C433F5 for ; Thu, 14 Oct 2021 16:55:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 322FF6109E for ; Thu, 14 Oct 2021 16:55:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 322FF6109E 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 BAC4B6B0071; Thu, 14 Oct 2021 12:55:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5BFC900002; Thu, 14 Oct 2021 12:55:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A72136B0073; Thu, 14 Oct 2021 12:55:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 98EC86B0071 for ; Thu, 14 Oct 2021 12:55:23 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 57FBF2FE14 for ; Thu, 14 Oct 2021 16:55:23 +0000 (UTC) X-FDA: 78695643726.14.C0922EE Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP id 146FA30000AD for ; Thu, 14 Oct 2021 16:55:21 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DB9D6101D; Thu, 14 Oct 2021 16:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634230522; bh=SK9fa8kBvKfk0pw+RnBE/3/wOfdzkDkUl60TS++n7Ms=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=URMDQCzgsfwoK5y/yNeoJ9JNO/8oJ2NMHAFhAdOy1sGEmtF9XAAISro92Op+4CLCV yz8pYDFNRFzXaJjjZZNkQmS6xjCt/ghBTpBe7izXZK2HZZK1u2FLlZOLXSvNd4nD06 5CanmAIdF34pzRmAIif5Q64GJtcQ5TngqgFvJeW3E9bfmHJTfsyZGGGL7cjuetxvNQ DjWaqDEAhLYF/YM9Is2bNH9fPhtpTop86L1W5TtLmWjFVRN3MvUgUa0tbyI4Tl/rs+ ROpY6NxCNDMdit7BPa0iEvomWIMDs3JszoYmWYSAtxoUAU4nwX7pJmq+LQ7+RU+IFc BqEp9rvWIEb2A== Date: Thu, 14 Oct 2021 09:55:15 -0700 From: Nathan Chancellor To: 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 Subject: Re: [PATCH] kasan: Always respect CONFIG_KASAN_STACK Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=URMDQCzg; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of nathan@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=nathan@kernel.org X-Stat-Signature: tngnetxfrbg757u1yatxfmm8d7ks1om6 X-Rspamd-Queue-Id: 146FA30000AD X-Rspamd-Server: rspam01 X-HE-Tag: 1634230521-998504 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: 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_OFF= SET 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_KASA= N_STACK > > > > is disabled, resulting in large stack warnings with allmodconfig: > > > > > > > > drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q0= 2.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 alon= g 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 > > >=20 > > > Reviewed-by: Marco Elver > >=20 > > Thanks! > >=20 > > > [ Which tree are you planning to take it through? ] > >=20 > > 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? >=20 > Acked-by: Palmer Dabbelt >=20 > (assuming you still want it through somewhere else) Thanks, it is now in mainline as commit 19532869feb9 ("kasan: always respect CONFIG_KASAN_STACK"). > > > Note, arch/riscv/include/asm/kasan.h mentions KASAN_SHADOW_OFFSET i= n > > > comment (copied from arm64). Did RISC-V just forget to copy over th= e > > > Kconfig option? > >=20 > > 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? >=20 > Ya, looks like we just screwed this up. I'm seeing some warnings like >=20 > cc1: warning: =E2=80=98-fsanitize=3Dkernel-address=E2=80=99 with sta= ck protection is not supported without =E2=80=98-fasan-shadow-offset=3D=E2= =80=99 for this target 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 a= bout > here? LMK if you were planning on sending along a fix or if you want m= e to > go figure it out. I took a look at moving the logic into Kconfig like arm64 before sending 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. Cheers, Nathan