rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] objtool/rust: relax slice condition to cover more `noreturn` Rust functions
@ 2025-05-20 18:55 Miguel Ojeda
  2025-05-20 20:10 ` Joel Fernandes
  2025-05-22  9:55 ` Miguel Ojeda
  0 siblings, 2 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-05-20 18:55 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Josh Poimboeuf, Peter Zijlstra
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kernel, patches, stable, John Hubbard,
	Timur Tabi, Kane York, Joel Fernandes

Developers are indeed hitting other of the `noreturn` slice symbols in
Nova [1], thus relax the last check in the list so that we catch all of
them, i.e.

    *_4core5slice5index22slice_index_order_fail
    *_4core5slice5index24slice_end_index_len_fail
    *_4core5slice5index26slice_start_index_len_fail
    *_4core5slice5index29slice_end_index_overflow_fail
    *_4core5slice5index31slice_start_index_overflow_fail

These all exist since at least Rust 1.78.0, thus backport it too.

See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
for more details.

Cc: stable@vger.kernel.org # Needed in 6.12.y and later.
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Timur Tabi <ttabi@nvidia.com>
Cc: Kane York <kanepyork@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Reported-by: Joel Fernandes <joelagnelf@nvidia.com>
Link: https://lore.kernel.org/rust-for-linux/20250513180757.GA1295002@joelnvbox/ [1]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
I tested it with the Timur's `alex` branch, but a Tested-by is appreciated.
Thanks!

 tools/objtool/check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index b21b12ec88d9..f23bdda737aa 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -230,7 +230,8 @@ static bool is_rust_noreturn(const struct symbol *func)
 	       str_ends_with(func->name, "_7___rustc17rust_begin_unwind")				||
 	       strstr(func->name, "_4core9panicking13assert_failed")					||
 	       strstr(func->name, "_4core9panicking11panic_const24panic_const_")			||
-	       (strstr(func->name, "_4core5slice5index24slice_") &&
+	       (strstr(func->name, "_4core5slice5index") &&
+		strstr(func->name, "slice_") &&
 		str_ends_with(func->name, "_fail"));
 }


base-commit: a5806cd506af5a7c19bcd596e4708b5c464bfd21
--
2.49.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] objtool/rust: relax slice condition to cover more `noreturn` Rust functions
  2025-05-20 18:55 [PATCH] objtool/rust: relax slice condition to cover more `noreturn` Rust functions Miguel Ojeda
@ 2025-05-20 20:10 ` Joel Fernandes
  2025-05-22  9:55 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2025-05-20 20:10 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Josh Poimboeuf, Peter Zijlstra, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kernel,
	patches, stable, John Hubbard, Timur Tabi, Kane York

On Tue, May 20, 2025 at 08:55:55PM +0200, Miguel Ojeda wrote:
> Developers are indeed hitting other of the `noreturn` slice symbols in
> Nova [1], thus relax the last check in the list so that we catch all of
> them, i.e.
> 
>     *_4core5slice5index22slice_index_order_fail
>     *_4core5slice5index24slice_end_index_len_fail
>     *_4core5slice5index26slice_start_index_len_fail
>     *_4core5slice5index29slice_end_index_overflow_fail
>     *_4core5slice5index31slice_start_index_overflow_fail
> 
> These all exist since at least Rust 1.78.0, thus backport it too.
> 
> See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
> for more details.
> 
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later.
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Timur Tabi <ttabi@nvidia.com>
> Cc: Kane York <kanepyork@gmail.com>
> Cc: Josh Poimboeuf <jpoimboe@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Reported-by: Joel Fernandes <joelagnelf@nvidia.com>

Fixes our nova-core warnings.

Tested-by: Joel Fernandes <joelagnelf@nvidia.com>

thanks,

 - Joel


> Link: https://lore.kernel.org/rust-for-linux/20250513180757.GA1295002@joelnvbox/ [1]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> I tested it with the Timur's `alex` branch, but a Tested-by is appreciated.
> Thanks!
> 
>  tools/objtool/check.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index b21b12ec88d9..f23bdda737aa 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -230,7 +230,8 @@ static bool is_rust_noreturn(const struct symbol *func)
>  	       str_ends_with(func->name, "_7___rustc17rust_begin_unwind")				||
>  	       strstr(func->name, "_4core9panicking13assert_failed")					||
>  	       strstr(func->name, "_4core9panicking11panic_const24panic_const_")			||
> -	       (strstr(func->name, "_4core5slice5index24slice_") &&
> +	       (strstr(func->name, "_4core5slice5index") &&
> +		strstr(func->name, "slice_") &&
>  		str_ends_with(func->name, "_fail"));
>  }
> 
> 
> base-commit: a5806cd506af5a7c19bcd596e4708b5c464bfd21
> --
> 2.49.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] objtool/rust: relax slice condition to cover more `noreturn` Rust functions
  2025-05-20 18:55 [PATCH] objtool/rust: relax slice condition to cover more `noreturn` Rust functions Miguel Ojeda
  2025-05-20 20:10 ` Joel Fernandes
@ 2025-05-22  9:55 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-05-22  9:55 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Josh Poimboeuf, Peter Zijlstra, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kernel,
	patches, stable, John Hubbard, Timur Tabi, Kane York,
	Joel Fernandes

On Tue, May 20, 2025 at 8:56 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Developers are indeed hitting other of the `noreturn` slice symbols in
> Nova [1], thus relax the last check in the list so that we catch all of
> them, i.e.
>
>     *_4core5slice5index22slice_index_order_fail
>     *_4core5slice5index24slice_end_index_len_fail
>     *_4core5slice5index26slice_start_index_len_fail
>     *_4core5slice5index29slice_end_index_overflow_fail
>     *_4core5slice5index31slice_start_index_overflow_fail
>
> These all exist since at least Rust 1.78.0, thus backport it too.
>
> See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
> for more details.
>
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later.
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Timur Tabi <ttabi@nvidia.com>
> Cc: Kane York <kanepyork@gmail.com>
> Cc: Josh Poimboeuf <jpoimboe@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Reported-by: Joel Fernandes <joelagnelf@nvidia.com>
> Link: https://lore.kernel.org/rust-for-linux/20250513180757.GA1295002@joelnvbox/ [1]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Applied to `rust-next` early so that others can benefit on -next --
thanks everyone!

    Fixes: 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-22  9:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-20 18:55 [PATCH] objtool/rust: relax slice condition to cover more `noreturn` Rust functions Miguel Ojeda
2025-05-20 20:10 ` Joel Fernandes
2025-05-22  9:55 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).