Skip to contentSkip to conversation

FAILED: patch "[PATCH] objtool/rust: add one more `noreturn` Rust function" failed to apply to 6.18-stable tree

PATCH [email protected] 2 participants 2 messages Sep 3

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 993f235c4af49d0e912cc28abe6d733531600237
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090341-uncanny-legwarmer-a899@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 993f235c4af49d0e912cc28abe6d733531600237 Mon Sep 17 00:00:00 2001
From: Miguel Ojeda <[email protected]>
Date: Wed, 5 Aug 2026 16:45:24 +0200
Subject: [PATCH] objtool/rust: add one more noreturn Rust function

When the pointer formatting series [1] is applied and KUnit tests are enabled, objtool would report an error with any of our supported Rust versions. For instance, with Rust 1.97.1:

rust/kernel.o: error: objtool: _R..._4core3fmt7Pointer3fmtB7_() falls through to next function _R..._4core7convert5AsRefNtB5_4BStrE6as_ref()

Or, with Rust 1.85.0:

rust/kernel.o: error: objtool: _R..._4core3fmt7Pointer3fmtB7_()
falls through to next function _R..._4core3ffi5c_str4CStrENtNtBS_3fmt7Display3fmtB7_()

This happens due to calls to the noreturn symbol:

core::str::slice_error_fail

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.

[ While the series [1] mentioned above was not applied in a way
that triggered this, Gary found another case [2]:

I am seeing this function causing issue on my 1.85.1 -Os build, although the error message is different this time:

rust/kernel.o: warning: objtool: _R..._5range9RangeFromjEE5indexCsldbe0TGTmNx_6kernel+0x1d:
stack state mismatch: cfa1=4+8 cfa2=4+16

Disassembly shows that the function call before the warning location is a call to _4core3str16slice_error_fail, and objtool thought it can return (which will end up with a unbalanced stack if it does return).

Thus apply it. - Miguel ]

tools/objtool/check.c +1 -0
index 87db9f4ed9e2..3ab5b9f1c6a4 100644
@@ -195,6 +195,7 @@ static bool is_rust_noreturn(const struct symbol *func)
 	return str_ends_with(func->name, "_4core3num20from_str_radix_panic")				||
 	       str_ends_with(func->name, "_4core3num22from_ascii_radix_panic")				||
 	       str_ends_with(func->name, "_4core3num28from_ascii_bytes_radix_panic")			||
+	       str_ends_with(func->name, "_4core3str16slice_error_fail")				||
 	       str_ends_with(func->name, "_4core5sliceSp15copy_from_slice17len_mismatch_fail")		||
 	       str_ends_with(func->name, "_4core6option13expect_failed")				||
 	       str_ends_with(func->name, "_4core6option13unwrap_failed")				||
#1 lore raw
Quoted 6 lines · On Thu, Sep 3, 2026 at 2:44 PM <[email protected]> wrote:

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 8 lines

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 993f235c4af49d0e912cc28abe6d733531600237
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090341-uncanny-legwarmer-a899@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

To solve this one and the related ones, please see this sequence of cherry-picks:

https://lore.kernel.org/stable/CANiq72kmYx5GBU7VL3z8h3bAWB=vw-TX+ptskDO0k3Ro-F450w@mail.gmail.com/

Cheers,
Miguel