From: "Gary Guo" <gary@garyguo.net>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Gary Guo" <gary@garyguo.net>
Cc: "Nathan Chancellor" <nathan@kernel.org>,
"Gary Guo" <gary@kernel.org>, "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Kees Cook" <kees@kernel.org>,
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
Date: Tue, 27 Jan 2026 23:27:00 +0000 [thread overview]
Message-ID: <DFZRED86Y1CZ.1J57GLBRJP1JJ@garyguo.net> (raw)
In-Reply-To: <CANiq72nK2K4mZNnpJSWP+Z1h3hkwSLtN+FOWKzUYdEJD92sU7A@mail.gmail.com>
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@garyguo.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
next prev parent reply other threads:[~2026-01-27 23:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260127172330.1492107-1-gary@kernel.org>
2026-01-27 17:11 ` [RFC PATCH 1/2] kbuild: rust: register "klint" as a tool Gary Guo
2026-01-27 17:11 ` [RFC PATCH 2/2] kbuild: rust: use klint to provide CONFIG_FRAME_WARN Gary Guo
2026-01-27 22:15 ` Nathan Chancellor
2026-01-27 22:51 ` Gary Guo
2026-01-27 23:12 ` Miguel Ojeda
2026-01-27 23:27 ` Gary Guo [this message]
2026-01-28 0:31 ` Alexandre Courbot
2026-01-28 1:14 ` Gary Guo
2026-01-28 22:02 ` Nathan Chancellor
2026-01-29 0:59 ` Gary Guo
2026-01-30 4:10 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DFZRED86Y1CZ.1J57GLBRJP1JJ@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=lossin@kernel.org \
--cc=masahiroy@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox