From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 296AB1E2858; Tue, 27 Jan 2026 22:15:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769552138; cv=none; b=cptgFchNxe69NB4BJ004o3lwJ7iSD+lQ3GebFK5nXkSlmflb2u2oEAdgsBd2bhRO6zAJvE7b0Hyp69LmkWYGGgZa5yWYktrauOn3thjnMCR3ckK75+qsxu6rH86rwRHF/KD6FzAW0XPNltAMQWxqeJ8lYCA/4HOG84tqbLVqrck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769552138; c=relaxed/simple; bh=rCVzcb2VqIkP6kh7ztnCGFKZ7Ne2o7rU4KtAlgh7Ul0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Tq8ajCIYzpxog9YSy8B3tHalNSfwvv/QmJ9Pgdsg6L3kYhA54JrWm0XfeVfyVyYaIdtaBRUOdCbf0uOsi48EA9S4FCzeaUkpgBi2p54YHDlifnQ0l3aoGRaAxqD9A9tdUMEJ/HYcbMG+mzIG6s+m5hOJOhjJh/BaMf3JatZrOyg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HGQsSvHz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HGQsSvHz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 901C5C116C6; Tue, 27 Jan 2026 22:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769552137; bh=rCVzcb2VqIkP6kh7ztnCGFKZ7Ne2o7rU4KtAlgh7Ul0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HGQsSvHzp0Td6egSmgBNndHDWQRJcKEay40Au44slRqwOuyd4RaKZkMCr9j+1PQDL c+CyLEpn2jGWytkoUjoSKDFsF62HOISUv0bV6Yn/DaTiK8nMcqHcBXxKDG43nse7t+ rpaRp487i8wnUv3FJXz2qT/gRnSXQOCxgkCWR/AUUKDzmIfrAuvBq88XBW0nSCRw1O gcb0YHrwTbrAELJlYxbdtu5N5dM2AuZgSg1eYW2flEze6SKAPn/DcScDEOFyokn8JG 9MH6MOePj5U4KpuZm6NfhnU3GQcoi+YLg6L1E3GjF4bvT4dAf7NKSakSVlsukTMP01 JChtEns89k09A== Date: Tue, 27 Jan 2026 15:15:31 -0700 From: Nathan Chancellor To: Gary Guo Cc: Miguel Ojeda , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Nicolas Schier , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Masahiro Yamada , Kees Cook , rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 2/2] kbuild: rust: use klint to provide CONFIG_FRAME_WARN Message-ID: <20260127221531.GC3382807@ax162> References: <20260127172330.1492107-1-gary@kernel.org> <20260127172330.1492107-3-gary@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260127172330.1492107-3-gary@kernel.org> On Tue, Jan 27, 2026 at 05:11:04PM +0000, Gary Guo wrote: > From: Gary Guo > > klint is able to analyze frame size and warn on frames that are too big. > > With `register_tool(klint)` support, we can simply instruct rust to turn on > `klint::stack_frame_too_large`. This is a no-op if normal rustc (or Clippy) > is invoked, but will perform the check if klint is used. > > This is an example of a bug caught using this option: > > warning: stack size of `gsp::cmdq::Cmdq::new` is 8216 bytes, exceeds the 2048-byte limit > --> drivers/gpu/nova-core/gsp/cmdq.rs:453:5 > | > 453 | pub(crate) fn new(dev: &device::Device) -> Result { > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > | > = note: the stack size is inferred from instruction `sub $0x2018,%rsp` at .text+32778 > > Signed-off-by: Gary Guo Acked-by: Nathan Chancellor Is the limit customizable? > --- > scripts/Makefile.warn | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn > index 5567da6c7dfe..254a4d53f8f3 100644 > --- a/scripts/Makefile.warn > +++ b/scripts/Makefile.warn > @@ -23,6 +23,7 @@ KBUILD_CFLAGS += -Wmissing-prototypes > > ifneq ($(CONFIG_FRAME_WARN),0) > KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN) > +KBUILD_RUSTFLAGS += -Wklint::stack-frame-too-large > endif > > KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds > -- > 2.51.2 >