This is a note to let you know that I've just added the patch titled rust: fix regexp in scripts/is_rust_module.sh to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: rust-fix-regexp-in-scripts-is_rust_module.sh.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ccc4505454db10402d5284f22d8b7db62e636fc5 Mon Sep 17 00:00:00 2001 From: Andrea Righi <andrea.righi@xxxxxxxxxxxxx> Date: Fri, 10 Feb 2023 16:26:22 +0100 Subject: rust: fix regexp in scripts/is_rust_module.sh From: Andrea Righi <andrea.righi@xxxxxxxxxxxxx> commit ccc4505454db10402d5284f22d8b7db62e636fc5 upstream. nm can use "R" or "r" to show read-only data sections, but scripts/is_rust_module.sh can only recognize "r", so with some versions of binutils it can fail to detect if a module is a Rust module or not. Right now we're using this script only to determine if we need to skip BTF generation (that is disabled globally if CONFIG_RUST is enabled), but it's still nice to fix this script to do the proper job. Moreover, with this patch applied I can also relax the constraint of "RUST depends on !DEBUG_INFO_BTF" and build a kernel with Rust and BTF enabled at the same time (of course BTF generation is still skipped for Rust modules). [ Miguel: The actual reason is likely to be a change on the Rust compiler between 1.61.0 and 1.62.0: echo '#[used] static S: () = ();' | rustup run 1.61.0 rustc --emit=obj --crate-type=lib - && nm rust_out.o echo '#[used] static S: () = ();' | rustup run 1.62.0 rustc --emit=obj --crate-type=lib - && nm rust_out.o Gives: 0000000000000000 r _ZN8rust_out1S17h48027ce0da975467E 0000000000000000 R _ZN8rust_out1S17h58e1f3d9c0e97cefE See https://godbolt.org/z/KE6jneoo4. ] Signed-off-by: Andrea Righi <andrea.righi@xxxxxxxxxxxxx> Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@xxxxxxxxx> Reviewed-by: Eric Curtin <ecurtin@xxxxxxxxxx> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- scripts/is_rust_module.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/is_rust_module.sh +++ b/scripts/is_rust_module.sh @@ -13,4 +13,4 @@ set -e # # In the future, checking for the `.comment` section may be another # option, see https://github.com/rust-lang/rust/pull/97550. -${NM} "$*" | grep -qE '^[0-9a-fA-F]+ r _R[^[:space:]]+16___IS_RUST_MODULE[^[:space:]]*$' +${NM} "$*" | grep -qE '^[0-9a-fA-F]+ [Rr] _R[^[:space:]]+16___IS_RUST_MODULE[^[:space:]]*$' Patches currently in stable-queue which might be from andrea.righi@xxxxxxxxxxxxx are queue-6.1/btf-scripts-rust-drop-is_rust_module.sh.patch queue-6.1/rust-fix-regexp-in-scripts-is_rust_module.sh.patch queue-6.1/kbuild-rust-avoid-creating-temporary-files.patch