Skip to contentSkip to conversation

objtool/rust: add one more `noreturn` Rust function

PATCH Applied Miguel Ojeda 4 participants 5 messages Apr 13, 2025 – Apr 14, 2025

Subsystems (3)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 objtool/rust: add one more `noreturn` Rust function

Starting with Rust 1.86.0 (see upstream commit b151b513ba2b ("Insert null checks for pointer dereferences when debug assertions are enabled") [1]), under some kernel configurations with CONFIG_RUST_DEBUG_ASSERTIONS=y, one may trigger a new objtool warning:

rust/kernel.o: warning: objtool: _R..._6kernel9workqueue6system() falls through to next function _R...9workqueue14system_highpri()

due to a call to the noreturn symbol:

core::panicking::panic_null_pointer_dereference

Thus add it to the list so that objtool knows it is actually noreturn.

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

Cc [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Fixes 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)
tools/objtool/check.c +1 -0
index 4a1f6c3169b3..67006eeb30c8 100644
@@ -225,6 +225,7 @@ static bool is_rust_noreturn(const struct symbol *func)
 	       str_ends_with(func->name, "_4core9panicking14panic_nounwind")				||
 	       str_ends_with(func->name, "_4core9panicking18panic_bounds_check")			||
 	       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")	||
 	       strstr(func->name, "_4core9panicking13assert_failed")					||
 	       strstr(func->name, "_4core9panicking11panic_const24panic_const_")			||

base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8

Signature · 1 line
2.49.0
maintainer
#1 lore raw

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it

Found matching upstream commit: cee6f9a9c87b6ecfb51845950c28216b231c3610

Note: The patch differs from the upstream commit:
---

1:  cee6f9a9c87b6 < -:  ------------- objtool/rust: add one more `noreturn` Rust function
-:  ------------- > 1:  a6ee72c789bbc objtool/rust: add one more `noreturn` Rust function

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.14.y       |  Success    |  Success   |
| stable/linux-6.13.y       |  Success    |  Success   |
| stable/linux-6.12.y       |  Success    |  Success   |
| stable/linux-6.6.y        |  Success    |  Success   |
| stable/linux-6.1.y        |  Success    |  Success   |
| stable/linux-5.15.y       |  Success    |  Success   |
| stable/linux-5.10.y       |  Success    |  Success   |
| stable/linux-5.4.y        |  Success    |  Success   |
#2 lore raw
Quoted 3 lines · Sasha Levin
1:  cee6f9a9c87b6 < -:  ------------- objtool/rust: add one more `noreturn` Rust function
-:  ------------- > 1:  a6ee72c789bbc objtool/rust: add one more `noreturn` Rust function

I guess this is due to the same title -- the patch is a new one. Sorry, I guess I should have changed the title a bit. When I apply it I can do so.

Cheers,
Miguel

reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Miguel Ojeda
Quoted 14 lines · Miguel Ojeda

Starting with Rust 1.86.0 (see upstream commit b151b513ba2b ("Insert null checks for pointer dereferences when debug assertions are enabled") [1]), under some kernel configurations with CONFIG_RUST_DEBUG_ASSERTIONS=y, one may trigger a new objtool warning:

rust/kernel.o: warning: objtool: _R..._6kernel9workqueue6system() falls through to next function _R...9workqueue14system_highpri()

due to a call to the noreturn symbol:

core::panicking::panic_null_pointer_dereference

Thus add it to the list so that objtool knows it is actually noreturn.

Quoted 7 lines

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

Cc [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Fixes 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
Applied
#4 lore raw
In reply to Miguel Ojeda
Quoted 2 lines · Miguel Ojeda

Thus add it to the list so that objtool knows it is actually noreturn.

Applied to rust-fixes -- thanks everyone! I applied it early to start to get testing -- tags still welcomed for a day or so.

I changed the title a bit (adding "for Rust 1.86.0") to avoid confusion with a previous patch (and future ones), since a bot already got confused.

If objtool prefers to apply this instead, please let me know and I will drop it!

Cheers,
Miguel