Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp361306rdb; Thu, 19 Oct 2023 06:46:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFE/aH4/vELLA0BZGYhEhSv+0TKgQBj6y9VxY6SN9fvLfRnzSfY0ccixsJQICTfos8pfQ6m X-Received: by 2002:a17:902:6b81:b0:1c6:1ab1:93eb with SMTP id p1-20020a1709026b8100b001c61ab193ebmr1986980plk.17.1697723185826; Thu, 19 Oct 2023 06:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697723185; cv=none; d=google.com; s=arc-20160816; b=efpFBahdPgXTrFO0Sxmpap7sy0dlIdz/sM62WghubH8d7qZj5473MSCGxsemAqanXR NJsrH0+rpIDb0XgZIEBWUJ1b9df8C2XRJtgrB2Bylml5GqfOIuMJEQQJZC+ocrGozPdL ERfV94FBGkqxLU9uUSes/a+mLaJJCL+M5wNhI4u4AG9n1eaD7CycVu28E9OAJd5QFTua jTGFYctZoRQZ5g8o9L4x7EzdlDV4J2zrbdiuGUfboM9q5FsTxOZKg0V5CFSwwDFoJdLa KE24xnSiGj/sWrIBKu5YfFMEz16VBoRGoJeCOQd9jemKcueVSNA5S5v8eXh4dHydprHP qafg== 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=c+OQf9mXsocdxZsSc7Qg9I7aF5FCLMuGCb54DwDnDIE=; fh=vHv7mZMzTmfkFqsRpdMTg5PywTeGgU0+oV01bTvNtMY=; b=KFq4nKeCBf7J/uVpVBfaxetuCuNepu5VZcxx8ndI2roy9tFUnLEBHzERnqaBeMJq88 FBnqdqbAS3V/WRe/9QLjVbRzRWp5Hha651OhiDzPA+wC4gNA6CUtJhAaooXCCKAWe3EZ JLjlIItFSpJxa4gUBnqJuEFO5OzX6d6paW490qWTgx39pVIjt0QvzZ/UjZ7KBzTzCs64 bUgkOG4wgtOeza/SwQ8ibtoe0/YR515SWb8CAJ2JHzWqqI9UWI0zd80VPG8yfiB8clLm PSWMXD33+bo1mOR7CoUqUzmbHok0gg3ac+Vg37anXZSF/xcg/MobuRw4cHPiJqphC1p+ k7gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=iYYwDelQ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mjx3p4xy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u11-20020a17090282cb00b001c7342b46e4si2056674plz.23.2023.10.19.06.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 06:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=iYYwDelQ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mjx3p4xy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0924D8048C39; Thu, 19 Oct 2023 06:46:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235375AbjJSNpx (ORCPT + 99 others); Thu, 19 Oct 2023 09:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346364AbjJSNEN (ORCPT ); Thu, 19 Oct 2023 09:04:13 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB691FD7; Thu, 19 Oct 2023 05:53:29 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id C215C3200ACE; Thu, 19 Oct 2023 08:53:23 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Thu, 19 Oct 2023 08:53:26 -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=1697720003; x=1697806403; bh=c+ OQf9mXsocdxZsSc7Qg9I7aF5FCLMuGCb54DwDnDIE=; b=iYYwDelQB/1pQrjDqD +wxGOVgX15b5fVhHulX5D1KgWssBiLtEWMUm88IdtPhTBXrrU9TAAhOpVPuIRXAd haM0sz6u4GsmCMqTZnboeJ19b/464N1s4W9XOb/c+kQl+rjHcxyug0YtC0Z0G7fH Lo1s+nzXVPBk6KSGQdaPQ5YSYTSTI1X0Qjrv4O96eWvkvB73sNDiGS4ENUnryZxA NNC2CKuqGgMR2DBoAh1Y6wCkll44M0s0+mvq8IPRFUF0zB/O8RxRjhGypTK9EpbC lLqUFX0K6H9h4Rrot0pMdqcUgLY05kdLNbZn0kdKfwfrT6T7lgqX5rH4gqrofkIh PiwA== 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=1697720003; x=1697806403; bh=c+OQf9mXsocdx ZsSc7Qg9I7aF5FCLMuGCb54DwDnDIE=; b=mjx3p4xyhc148ce0bmL6NGiNVF1PH 2meSQ1Y0xo9jkztYxxZFxoOx17sAyptr3psxKQqa0+BItwMMmC1FBeHMJltK7+Fw zwx9HSmRJfmu5jO+yLEZ5PToLdjzHgM94u006RLdD9ovfMO3O+bGeLmnazuCaYx5 ciN2DuwDBblj09x3ph3Sdnko+BJjvPWL36HJ1UPSmiF8I0X3UHv0gEwGHeI3EXd2 yPtWh7jXY83BOvm1qRWUG68wjzryk0qQyj9ON0OEmBRziZPp5RkXiNbD1iUlMcd2 2GTxSJiLqzT2C4DDykOJACpAXeIC+tfbFm0sNSgHElPCIED44huQMMFkQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjeeigdehjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2D5DEB60089; Thu, 19 Oct 2023 08:53:22 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1019-ged83ad8595-fm-20231002.001-ged83ad85 MIME-Version: 1.0 Message-Id: <22580470-7def-4723-b836-1688db6da038@app.fastmail.com> In-Reply-To: References: <20231018182412.80291-1-hamza.mahfooz@amd.com> Date: Thu, 19 Oct 2023 14:53:01 +0200 From: "Arnd Bergmann" To: "Alexander Potapenko" , "Geert Uytterhoeven" Cc: "Hamza Mahfooz" , linux-kernel@vger.kernel.org, "Rodrigo Siqueira" , "Harry Wentland" , "Alex Deucher" , stable@vger.kernel.org, "Miguel Ojeda" , "Alex Gaynor" , "Wedson Almeida Filho" , "Boqun Feng" , "Gary Guo" , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , "Nick Terrell" , "Nathan Chancellor" , "Nick Desaulniers" , "Tom Rix" , "Andrew Morton" , "Masami Hiramatsu" , "Randy Dunlap" , "Kees Cook" , "Zhaoyang Huang" , "Li Hua" , "Rae Moar" , rust-for-linux@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] lib/Kconfig.debug: disable FRAME_WARN for kasan and kcsan Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 06:46:09 -0700 (PDT) On Thu, Oct 19, 2023, at 12:04, Alexander Potapenko wrote: >> > > Are kernels with KASAN || KCSAN || KMSAN enabled supposed to be bootable? >> > >> > They are all intended to be used for runtime debugging, so I'd imagine so. >> >> Then I strongly suggest putting a nonzero value here. As you write >> that "with every release of LLVM, both of these sanitizers eat up more and more >> of the stack", don't you want to have at least some canary to detect >> when "more and more" is guaranteed to run into problems? > > FRAME_WARN is a poor canary. First, it does not necessarily indicate > that a build is faulty (a single bloated stack frame won't crash the > system). I agree it's flawed, but it does catch a lot of bugs, both in the driver and the compiler. What we should probably have is some better runtime debugging in addition to FRAME_WARN, but it's better than nothing. One idea that I've suggested in the past is to add a soft stack limit that is lower than THREAD_SIZE, using VMAP_STACK with a custom stack start and a read-only page at the end to catch a thread exceeding the soft limit and print a backtrace before marking the page writable. > Second, devs are unlikely to fix a function because its stack frame is > too big under some exotic tool+compiler combination. I've probably sent hundreds of fixes for these in the past. Most of the time there is an actual driver bug, and almost always the driver maintainers are responsive and treat the report with the appropriate urgency: even if only some configurations actually push it over the limit, the general case is some data structure that is hundreds of bytes long and was not actually meant to be on the stack. The gcc bug reports also usually get addressed quickly, though we've had problems with clang not making progress on known bugs for years. It sounds like Nick has made some important progress on clang very recently, so we should be able to raise the minimum clang version for kasan and kcsan once there is a known good release. > So the remaining option would be to just increase the frame size every > time a new function surpasses the limit. That is clearly not an option, though we could try to add Kconfig dependencies that avoid the known bad combinations, such as annotating the AMD GPU driver as depends on (CC_IS_GCC || CLANG_VERSION >=180000) || !(KASAN || KCSAN) Arnd