[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFZRED86Y1CZ.1J57GLBRJP1JJ@garyguo.net>
Date: Tue, 27 Jan 2026 23:27:00 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>, "Gary Guo"
<gary@...yguo.net>
Cc: "Nathan Chancellor" <nathan@...nel.org>, "Gary Guo" <gary@...nel.org>,
"Miguel Ojeda" <ojeda@...nel.org>, "Boqun Feng" <boqun.feng@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Danilo
Krummrich" <dakr@...nel.org>, "Nicolas Schier" <nsc@...nel.org>,
Thomas Weißschuh <linux@...ssschuh.net>, "Masahiro Yamada"
<masahiroy@...nel.org>, "Kees Cook" <kees@...nel.org>,
<rust-for-linux@...r.kernel.org>, <linux-kbuild@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 2/2] kbuild: rust: use klint to provide
CONFIG_FRAME_WARN
On Tue Jan 27, 2026 at 11:12 PM GMT, Miguel Ojeda wrote:
> On Tue, Jan 27, 2026 at 11:51 PM Gary Guo <gary@...yguo.net> wrote:
>>
>> Lints in Rust do not take arguments, so there's no way to represent something
>> similar to `-Wframe-larger-than=foo`. However, I've made klint search [1] for
>> `CONFIG_FRAME_WARN` and use whatever value is there.
>>
>> Link: https://github.com/Rust-for-Linux/klint/blob/168031d93c3aa538c8ef71d1e448ae77c2cef7a7/src/binary_analysis/stack_size.rs#L70-L82 [1]
>
> I would have suggested a `.klint.toml` like Clippy, but with Clippy we
> also want to eventually have a flag-based configuration instead of a
> static file (or attributes in the source code which means probably
> using conditional compilation in some cases).
>
> So, even if the lint is toggled with `-[AWDF]` style flags, could the
> limit be configured in a separate non-`-W` Klint-only flag? Or doesn't
> `register_tool` allow for that?
No, there is no tool-specific flags.
I *could* add new flags by intercepting the parsing of command line in klint,
but doing so would require conditional passing of command line based on if the
compiler driver is klint, making it not a drop-in replacement for rustc, which
is something that I want to avoid.
I think the best path forward is `--crate-attr klint::attr', but that is gated
behind custom_inner_attributes feature which is further away from stability.
A shorter term solution might be to add a cfg specific to klint? For example,
`--cfg klint_stack_frame_size_limit=foo`. This way the interface at least is
specific and not relying on Kbuild internals.
Best,
Gary
Powered by blists - more mailing lists