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 4BFC7C433EF for ; Fri, 8 Oct 2021 18:46:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DAA9961039 for ; Fri, 8 Oct 2021 18:46:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DAA9961039 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 2EA8F940007; Fri, 8 Oct 2021 14:46:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29A586B0075; Fri, 8 Oct 2021 14:46:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1626E940007; Fri, 8 Oct 2021 14:46:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id 061F76B0074 for ; Fri, 8 Oct 2021 14:46:58 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B4BE62BA71 for ; Fri, 8 Oct 2021 18:46:57 +0000 (UTC) X-FDA: 78674152074.20.738E9C5 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 4C482507894B for ; Fri, 8 Oct 2021 18:46:57 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id g2so8940747pfc.6 for ; Fri, 08 Oct 2021 11:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=quuSqZ0dONVuv9mo4TeP3YIzWz+O416I07kQnnw7STA=; b=VP3FxMvbz5TL9ETbQUQchYZN5L4JzqpHPf5RtFeE3ZfDwplk+2AwbE5NYJyD1Dwm64 OURJONO70AuDhhUUMsC6mqZ0G6vpAdpP88r9Vat/ksn3WojuY1MZE2iby4R/hU8ULX1g D5tF5tPYrB+h8S+lezt7+hxCysnobBIbL9yDUtqZ6s/E4NZYhAJIyuqj/yk3upT3mVoC D2B84lQfOuy11lNLZbdj5WLptstGzspyTbtIPgniNYtZfX4pE78j+I5Yb8Sb09PlYEF1 QGrIKY+xG+/pJIw5Oxli7c2qFSNLq7bwRSQYjwaNYbsqfW4hfmsh66cpOKPD89L8UKOW HgYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=quuSqZ0dONVuv9mo4TeP3YIzWz+O416I07kQnnw7STA=; b=YUVnY30PTUE6k6vKYNX8apB54BRG1iGJ98jCK1mmoNSfr+LaolJb0/reK8YLYLhxOy CWDv7CiuhkirE3XMfZuVGTJu+ejROIlGxiUWX+8MqvL5N6yqTJhyKY0Tvyr8rXGEBG+f MyySdeyRZMdq8g5MrC4P3xgpl4+YKxtWwMNqYB/UnmkdtiYVgA7sgUuNAeeruNUvCJb1 tV4QqDaHOBlCPv3dBj3uUATdQ0rHHuBjSWuobk3uZSBP+ROlkJ00eyE73ubz9gVaZSMj kwM6bad2fU6V3RRv5/c6DumLG6JGR+cTeYEbyE+rt2Xkj5pXLDqiWz+TLW+pMErlMrq8 pfqw== X-Gm-Message-State: AOAM533zFbzQ8L33kvccBLXoV7kBm6690jXuQ99emK0BiCm5aVD7TbCz EcD0+M5bRUdyCB9VTg/jucrH2Q== X-Google-Smtp-Source: ABdhPJxAT5BQrmJ3JUtPZaaQj9/pOPmAgQLcheO9hTXDYLo9/eegEa4BrfVFO430mNlT7+7pI3Tbjw== X-Received: by 2002:a63:b214:: with SMTP id x20mr6037587pge.460.1633718816009; Fri, 08 Oct 2021 11:46:56 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id k17sm73056pff.214.2021.10.08.11.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 11:46:55 -0700 (PDT) Date: Fri, 08 Oct 2021 11:46:55 -0700 (PDT) X-Google-Original-Date: Fri, 08 Oct 2021 10:00:34 PDT (-0700) Subject: Re: [PATCH] kasan: Always respect CONFIG_KASAN_STACK In-Reply-To: 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 From: Palmer Dabbelt To: nathan@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed X-Rspamd-Queue-Id: 4C482507894B X-Stat-Signature: 1hcb6z3qapbn78xxzmp9tc95jukx893i Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=VP3FxMvb; spf=pass (imf01.hostedemail.com: domain of palmer@dabbelt.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=palmer@dabbelt.com; dmarc=none X-Rspamd-Server: rspam06 X-HE-Tag: 1633718817-496403 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 w= rote: >> > 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 tha= t >> > asan-stack does not get disabled with clang even when CONFIG_KASAN_S= TACK >> > 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 t= o >> > 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 an= d 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) >> 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 di= d > 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? 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 stac= k protection is not supported without =E2=80=98-fasan-shadow-offset=3D=E2= =80=99 for this target which is how I ended up here, I'm assuming that's what you're talking=20 about here? LMK if you were planning on sending along a fix or if you=20 want me to go figure it out. > >> > --- >> > 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 :=3D $(CFLAGS_KASAN_SHADOW) \ >> > $(call cc-param,asan-globals=3D1) \ >> > $(call cc-param,asan-instrumentation-with-call-threshold=3D= $(call_threshold)) \ >> > - $(call cc-param,asan-stack=3D$(stack_enable)) \ >> > $(call cc-param,asan-instrument-allocas=3D1) >> > endif >> > >> > +CFLAGS_KASAN +=3D $(call cc-param,asan-stack=3D$(stack_enable)) >> > + >> > endif # CONFIG_KASAN_GENERIC >> > >> > ifdef CONFIG_KASAN_SW_TAGS >> > >> > base-commit: 4057525736b159bd456732d11270af2cc49ec21f >> > -- >> > 2.33.0.514.g99c99ed825 >> > >> >