Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp658343pxb; Thu, 23 Sep 2021 08:05:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyn+Z913l/vbQcBWUTWkHm1ld/VpRUlIEMehAOhCVc9O0SYlo5G5YDvP43MPvA+p/i4+FI X-Received: by 2002:a17:906:1bb1:: with SMTP id r17mr5386845ejg.533.1632409528632; Thu, 23 Sep 2021 08:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632409528; cv=none; d=google.com; s=arc-20160816; b=tm16bUrgA+Q8P61v/TEWA+57ODCYl2CwOJOebsunzNijAdVXItXTS2n86/QEf/BquL t6zzQeNk6po1CfgxxzrECMm5cQFJL3iiIzw6bjIWrrayfhl4LYhudU5W60rwKkO0nH7k 5D0NqhfbNaf7LvRFbVZPe3jzhEbo8PO2QVE7TnwJydv9ZRpLviv5e4U3yh6Jz6oHomdM YZPeLYdIuTl979LvWQs+ow+n/YaxjKihQZe4rmP2I3M1NdqeL5OGJQ9ktWbHCgm7oTUp kFK8czTG6RNiqXVBk+nZ+soDfJT19n0kkHnNaNwWOrE6D/F2AhIo5qWKFE7XXsLDoigJ 6bsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1Bm69zIOCyX2o9ZI+FreHVvqZswAGtnW++Y+vtuwEAo=; b=jPCAyzsT6PRpNBYy0DE9GFDlKOEydb4Jb2FrAdJs+eyzMyF66xYMFv+FILcT1+7sgK GweYip2tyPV5wp8rQEDENVShcNfLTTnecooS9iO3M7f1ccOhZPmNiEni1NI4X2NT3Ecz 4RQ3Bn0zi7Wfhb+gr0OXGcfW4KeAdZECOi8Dx7F0+bE4EcCZBF7OQinu/Dws/YRHSam5 JVkPs8KpgDgHHGYXKg90+NxmNlfthnu1Sz0VTjzFQYuCACjGjoy6vFoIDVQ+hJkp5XDJ PYUjncJdXBcv4bdskcbndF3RUFPkcqnsxKsbv4+8gNr5zOgNEhp83FPqc1RtJ2E0oy24 K7+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NHICIs3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l22si6212512edj.479.2021.09.23.08.04.55; Thu, 23 Sep 2021 08:05:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NHICIs3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241839AbhIWPBY (ORCPT + 99 others); Thu, 23 Sep 2021 11:01:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241807AbhIWPBY (ORCPT ); Thu, 23 Sep 2021 11:01:24 -0400 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 > > > >