Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2424831rwr; Fri, 21 Apr 2023 08:42:56 -0700 (PDT) X-Google-Smtp-Source: AKy350Y8PTawkshvwMbMlW1bYqS+6KWST4fEOjsal9+Che1Ko+8kEJK+ECD19oLHxsvw+KC6RY5R X-Received: by 2002:a05:6a21:3384:b0:f0:251f:f099 with SMTP id yy4-20020a056a21338400b000f0251ff099mr7629064pzb.1.1682091775985; Fri, 21 Apr 2023 08:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682091775; cv=none; d=google.com; s=arc-20160816; b=M4hG1c3Txw8wgmI6cwb7dQ0Z6C1zGqKO35XVjY/ZzzSqZSJztfuZG1fgLCckJaX79k 39rMOnxvh4+XJuu5eePn3JEhWSETHvsQ58sv9bZ8WBQWQ9jBEeIz9R3KGTRHwaScrC/U sEX1K+AfLbxOZii7hQ8zCJw94VwozJvuDurx0fTKE01uicqzj5kacEifZoJqoe2oFovH ozjSMOmUMNrSR9h9sysu7bZG4yoi2IKw9F5iZ+Lm+q2q9bTtLO8SUhV4VmooghYgYO0+ PlKUTRNol2i1lisn/SKiIIqjdnnbnVYb6l+xbJPBPOCOGbzHNEUaj1tAYWOTcTgdTPgv ENHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=UPcMqJZ0P9N+7xzCJQfPEeFFIsp8Kyk+UricifK8t2M=; b=QunT2JJtoHPfIrQ/Un7zTKELTEB0PTGuJNC5AyPJ9KKNH7Lu5x+CsrYw/Qnjoss42o 7CTHIC8ERsHS7SFczhiDkquGWPE3htVOZpNIUPpghGK9PcgL8ZMIDb2a+YWWfTg18BKf usT3YlBuyHrC3XXPYg28hTX/sjoxeoK+b7itiia7fu7lccSesjz1jWx90aUPPIRgaRDy dGKTIUPoVmiOJQVH2wd7R8iQx33tNXLzFBRxwA4/mQTzLmXrzi9Ic7Nw7fGZIJ8mf82N jVxPdU/bXJ/WqRuvknUg+KebUd9fohn/420ulkltT8loSTK0M5xlPRpXeoDRzxs1/jxT FoxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=PwhfxD33; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Mbr3ig5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a656710000000b00502f0410410si4536270pgf.472.2023.04.21.08.42.42; Fri, 21 Apr 2023 08:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=PwhfxD33; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Mbr3ig5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232831AbjDUP2z (ORCPT + 99 others); Fri, 21 Apr 2023 11:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232692AbjDUP2y (ORCPT ); Fri, 21 Apr 2023 11:28:54 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F6005B88 for ; Fri, 21 Apr 2023 08:28:53 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 2F4545C018B; Fri, 21 Apr 2023 11:28:50 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Fri, 21 Apr 2023 11:28:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1682090930; x=1682177330; bh=UP cMqJZ0P9N+7xzCJQfPEeFFIsp8Kyk+UricifK8t2M=; b=PwhfxD33msHwYZJhDN Rz3H93n7oYbGH29nQ5i3Y9zMhXdnVAKKdyKoe821jOdNHpG9t8KUJeBWIoj7L7q0 KD9zR6QeVKbnWsdeLiMT74fDjp6dT+aQMTWBgWmLp1ldTvq7ZB5S9QYhUif8hjOH hnVeoHwGH8ZVQiPw5/xEylPtFKn9a5fqpdz6ibR1JIw/T1kSm/7j1/jEqsmoYPWK PnEgDBkjSIsYH5BuurkMKLjvZDicXGZ5CyF0Cy8u1PQdFXdnDRgeezZ3XEvDOGh+ nhM23ND9kaXc1YsyBdZ1hRGeG7XvlfxGvvBscIbPbN9HbGNLd2RJE1miJVZP1L+W xYZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1682090930; x=1682177330; bh=UPcMqJZ0P9N+7 xzCJQfPEeFFIsp8Kyk+UricifK8t2M=; b=Mbr3ig5z+4n15DHhycir6p6rXWfj+ KX3nMEPlRPSskGmsfxecBJraYmNC0kPsGVUiYj2Yqg7LgRX79+MSTh5rkp9jI6yw wQx9qXKy7f7f9gsTOcaVPuOiGO3TO5YS1u+2Aai2gU1eyj44cS4PjTCOkiqzjMiT D6ghS8FO5mFcFFNCPDskOLBHhUg51+2hhd4gxdCOk/4p7DRmmIOzmuCwp/ksUkdt cwNv35ExmmzK7zOJQVTqjhWnCi8DBvncMxwIx2LdnHwtUMCMgTFzaFtFTgb/sEFT QODbcwNlTSUdZKn3BR1X0fwKBVAHnu6gZVxeNwIlGPfiGzyWDbmfAK0cQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedtgedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 39A5BB60086; Fri, 21 Apr 2023 11:28:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-372-g43825cb665-fm-20230411.003-g43825cb6 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20230421130111.4041641-1-tudor.ambarus@linaro.org> <5d13e927-3713-4b9e-b007-6be5671d46f2@app.fastmail.com> Date: Fri, 21 Apr 2023 17:28:28 +0200 From: "Arnd Bergmann" To: "Tudor Ambarus" , "Nathan Chancellor" , "Nick Desaulniers" , "Tom Rix" , "Andrew Morton" Cc: joneslee@google.com, "Peter Zijlstra" , "Kees Cook" , "Josh Poimboeuf" , zhaoyang.huang@unisoc.com, "Liam R. Howlett" , "Randy Dunlap" , "Geert Uytterhoeven" , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, "Mark Brown" , "Dmitry Vyukov" , nogikh@google.com Subject: Re: [PATCH] Kconfig.debug: disable CONFIG_FRAME_WARN for KASAN_STACK && CC_IS_CLANG by default Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 21, 2023, at 17:10, Tudor Ambarus wrote: > On 4/21/23 15:30, Arnd Bergmann wrote: >> On Fri, Apr 21, 2023, at 15:01, Tudor Ambarus wrote: >> >>> The conclusion is that when KASAN is enabled the stack usage increases a >>> bit, but nothing unmanageable ~30-70 bytes, whereas when enabling >>> KASAN_STACK the stack usage is excessive, from ~1.7K to ~5.8K for these >>> cases. >>> >>> Disable CONFIG_FRAME_WARN for KASAN_STACK && CC_IS_CLANG by default. >>> Adventurers can still override the default value by input prompt or >>> explicit values in defconfigs in case they feel that some real warnings >>> are missed. >>> >>> Signed-off-by: Tudor Ambarus >> >> I think we are still better off with the warning enabled. When someone >> really wants to run a kernel with KASAN_STACK enabled, they should have >> a chance to see what they are getting into and not report any runtime >> bugs that come from stack overflow. >> > > Are such stack overflows warnings reliable when we know that stack > instrumentation causes excessive stack usage? Until clang is fixed one > shall hunt frame-larger-than warnings with KASAN_STACK disabled. The main problem with stack frame usage is that the compiler cannot know during compile time what the other functions are going to use, so it's always a bit of guesswork, and we just try to make the limit as small as possible without causing too much work addressing the warnings. Only if the frame usage grows beyond the actual available stack size, it's guaranteed to crash (I've seen 80KB for a single function, clearly larger than 16kb of total stack size), but the larger it gets, the more problems you'll run into. We already discussed years ago how clang can improve a lot of the cases here by reworking the amount of padding between variables similar to how gcc does it. This won't work for all files, but for a lot of them, and once clang gets fixed, we can address the remaining ones by working around them in the kernel. Arnd