[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250513180757.GA1295002@joelnvbox>
Date: Tue, 13 May 2025 14:07:57 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev,
stable@...r.kernel.org, Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, ttabi@...dia.com,
acourbot@...dia.com, jhubbard@...dia.com, apopple@...dia.com
Subject: Re: [PATCH 1/5] objtool/rust: add one more `noreturn` Rust function
for Rust 1.87.0
Hello Miguel,
On Fri, May 02, 2025 at 04:02:33PM +0200, Miguel Ojeda wrote:
> Starting with Rust 1.87.0 (expected 2025-05-15), `objtool` may report:
>
> rust/core.o: warning: objtool: _R..._4core9panicking9panic_fmt() falls
> through to next function _R..._4core9panicking18panic_nounwind_fmt()
>
> rust/core.o: warning: objtool: _R..._4core9panicking18panic_nounwind_fmt()
> falls through to next function _R..._4core9panicking5panic()
We are seeing a similar issue with the patch [1]:
RUSTC [M] drivers/gpu/nova-core/nova_core.o
drivers/gpu/nova-core/nova_core.o: warning: objtool:
<nova_core::vbios::PciAtBiosImage as
core::convert::TryFrom<nova_core::vbios::BiosImageBase>>::try_from() falls
through to next function <nova_core::vbios::FwSecBiosImage>::fwsec_header()
The code in concern is implementing try_from():
+
+impl TryFrom<BiosImageBase> for PciAtBiosImage {
+ type Error = Error;
+
+ fn try_from(base: BiosImageBase) -> Result<Self> {
I dumped the codegen [2] for this function and at the end of the codegen, there
is a call instruction to to the fwsec_header() function.
Any thoughts on how to fix the warning?
thanks,
- Joel
[1] https://lore.kernel.org/all/20250420-nova-frts-v1-13-ecd1cca23963@nvidia.com/
[2] https://paste.debian.net/1374516/
> The reason is that `rust_begin_unwind` is now mangled:
>
> _R..._7___rustc17rust_begin_unwind
>
> Thus add the mangled one to the list so that `objtool` knows it is
> actually `noreturn`.
>
> See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
> for more details.
>
> Alternatively, we could remove the fixed one in `noreturn.h` and relax
> this test to cover both, but it seems best to be strict as long as we can.
>
> Cc: stable@...r.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Cc: Josh Poimboeuf <jpoimboe@...nel.org>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
> ---
> tools/objtool/check.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 3a411064fa34..b21b12ec88d9 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -227,6 +227,7 @@ static bool is_rust_noreturn(const struct symbol *func)
> str_ends_with(func->name, "_4core9panicking19assert_failed_inner") ||
> str_ends_with(func->name, "_4core9panicking30panic_null_pointer_dereference") ||
> str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference") ||
> + str_ends_with(func->name, "_7___rustc17rust_begin_unwind") ||
> strstr(func->name, "_4core9panicking13assert_failed") ||
> strstr(func->name, "_4core9panicking11panic_const24panic_const_") ||
> (strstr(func->name, "_4core5slice5index24slice_") &&
> --
> 2.49.0
Powered by blists - more mailing lists