]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jul 2025 09:40:20 +0000 (11:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jul 2025 09:40:20 +0000 (11:40 +0200)
added patches:
net-libwx-fix-multicast-packets-received-count.patch
rust-use-to-fix-build-and-modpost-with-rust-1.89.0.patch

queue-6.15/net-libwx-fix-multicast-packets-received-count.patch [new file with mode: 0644]
queue-6.15/rust-use-to-fix-build-and-modpost-with-rust-1.89.0.patch [new file with mode: 0644]
queue-6.15/series

diff --git a/queue-6.15/net-libwx-fix-multicast-packets-received-count.patch b/queue-6.15/net-libwx-fix-multicast-packets-received-count.patch
new file mode 100644 (file)
index 0000000..c32b712
--- /dev/null
@@ -0,0 +1,36 @@
+From 2b30a3d1ec2538a1fd363fde746b9fe1d38abc77 Mon Sep 17 00:00:00 2001
+From: Jiawen Wu <jiawenwu@trustnetic.com>
+Date: Mon, 14 Jul 2025 09:56:56 +0800
+Subject: net: libwx: fix multicast packets received count
+
+From: Jiawen Wu <jiawenwu@trustnetic.com>
+
+commit 2b30a3d1ec2538a1fd363fde746b9fe1d38abc77 upstream.
+
+Multicast good packets received by PF rings that pass ethternet MAC
+address filtering are counted for rtnl_link_stats64.multicast. The
+counter is not cleared on read. Fix the duplicate counting on updating
+statistics.
+
+Fixes: 46b92e10d631 ("net: libwx: support hardware statistics")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Link: https://patch.msgid.link/DA229A4F58B70E51+20250714015656.91772-1-jiawenwu@trustnetic.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/wangxun/libwx/wx_hw.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/net/ethernet/wangxun/libwx/wx_hw.c
++++ b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
+@@ -2523,6 +2523,8 @@ void wx_update_stats(struct wx *wx)
+               hwstats->fdirmiss += rd32(wx, WX_RDB_FDIR_MISS);
+       }
++      /* qmprc is not cleared on read, manual reset it */
++      hwstats->qmprc = 0;
+       for (i = 0; i < wx->mac.max_rx_queues; i++)
+               hwstats->qmprc += rd32(wx, WX_PX_MPRC(i));
+ }
diff --git a/queue-6.15/rust-use-to-fix-build-and-modpost-with-rust-1.89.0.patch b/queue-6.15/rust-use-to-fix-build-and-modpost-with-rust-1.89.0.patch
new file mode 100644 (file)
index 0000000..b393da6
--- /dev/null
@@ -0,0 +1,167 @@
+From 7498159226772d66f150dd406be462d75964a366 Mon Sep 17 00:00:00 2001
+From: Miguel Ojeda <ojeda@kernel.org>
+Date: Sat, 12 Jul 2025 18:01:03 +0200
+Subject: rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Miguel Ojeda <ojeda@kernel.org>
+
+commit 7498159226772d66f150dd406be462d75964a366 upstream.
+
+Starting with Rust 1.89.0 (expected 2025-08-07), the Rust compiler fails
+to build the `rusttest` target due to undefined references such as:
+
+    kernel...-cgu.0:(.text....+0x116): undefined reference to
+    `rust_helper_kunit_get_current_test'
+
+Moreover, tooling like `modpost` gets confused:
+
+    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/nova/nova.o
+    ERROR: modpost: missing MODULE_LICENSE() in drivers/gpu/nova-core/nova_core.o
+
+The reason behind both issues is that the Rust compiler will now [1]
+treat `#[used]` as `#[used(linker)]` instead of `#[used(compiler)]`
+for our targets. This means that the retain section flag (`R`,
+`SHF_GNU_RETAIN`) will be used and that they will be marked as `unique`
+too, with different IDs. In turn, that means we end up with undefined
+references that did not get discarded in `rusttest` and that multiple
+`.modinfo` sections are generated, which confuse tooling like `modpost`
+because they only expect one.
+
+Thus start using `#[used(compiler)]` to keep the previous behavior
+and to be explicit about what we want. Sadly, it is an unstable feature
+(`used_with_arg`) [2] -- we will talk to upstream Rust about it. The good
+news is that it has been available for a long time (Rust >= 1.60) [3].
+
+The changes should also be fine for previous Rust versions, since they
+behave the same way as before [4].
+
+Alternatively, we could use `#[no_mangle]` or `#[export_name = ...]`
+since those still behave like `#[used(compiler)]`, but of course it is
+not really what we want to express, and it requires other changes to
+avoid symbol conflicts.
+
+Cc: David Wood <david@davidtw.co>
+Cc: Wesley Wiser <wwiser@gmail.com>
+Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
+Link: https://github.com/rust-lang/rust/pull/140872 [1]
+Link: https://github.com/rust-lang/rust/issues/93798 [2]
+Link: https://github.com/rust-lang/rust/pull/91504 [3]
+Link: https://godbolt.org/z/sxzWTMfzW [4]
+Reviewed-by: Alice Ryhl <aliceryhl@google.com>
+Acked-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
+Link: https://lore.kernel.org/r/20250712160103.1244945-3-ojeda@kernel.org
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ rust/Makefile           |    1 +
+ rust/kernel/firmware.rs |    2 +-
+ rust/kernel/kunit.rs    |    2 +-
+ rust/kernel/lib.rs      |    2 ++
+ rust/macros/module.rs   |   10 +++++-----
+ scripts/Makefile.build  |    2 +-
+ 6 files changed, 11 insertions(+), 8 deletions(-)
+
+--- a/rust/Makefile
++++ b/rust/Makefile
+@@ -194,6 +194,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $<
+       RUST_MODFILE=test.rs \
+       OBJTREE=$(abspath $(objtree)) \
+       $(RUSTDOC) --test $(rust_common_flags) \
++              -Zcrate-attr='feature(used_with_arg)' \
+               @$(objtree)/include/generated/rustc_cfg \
+               $(rustc_target_flags) $(rustdoc_test_target_flags) \
+               $(rustdoc_test_quiet) \
+--- a/rust/kernel/firmware.rs
++++ b/rust/kernel/firmware.rs
+@@ -202,7 +202,7 @@ macro_rules! module_firmware {
+             };
+             #[link_section = ".modinfo"]
+-            #[used]
++            #[used(compiler)]
+             static __MODULE_FIRMWARE: [u8; $($builder)*::create(__MODULE_FIRMWARE_PREFIX)
+                 .build_length()] = $($builder)*::create(__MODULE_FIRMWARE_PREFIX).build();
+         };
+--- a/rust/kernel/kunit.rs
++++ b/rust/kernel/kunit.rs
+@@ -278,7 +278,7 @@ macro_rules! kunit_unsafe_test_suite {
+                     is_init: false,
+                 };
+-            #[used]
++            #[used(compiler)]
+             #[allow(unused_unsafe)]
+             #[cfg_attr(not(target_os = "macos"), link_section = ".kunit_test_suites")]
+             static mut KUNIT_TEST_SUITE_ENTRY: *const ::kernel::bindings::kunit_suite =
+--- a/rust/kernel/lib.rs
++++ b/rust/kernel/lib.rs
+@@ -26,6 +26,8 @@
+ #![feature(const_mut_refs)]
+ #![feature(const_ptr_write)]
+ #![feature(const_refs_to_cell)]
++// To be determined.
++#![feature(used_with_arg)]
+ // Ensure conditional compilation based on the kernel configuration works;
+ // otherwise we may silently break things like initcall handling.
+--- a/rust/macros/module.rs
++++ b/rust/macros/module.rs
+@@ -57,7 +57,7 @@ impl<'a> ModInfoBuilder<'a> {
+                 {cfg}
+                 #[doc(hidden)]
+                 #[cfg_attr(not(target_os = \"macos\"), link_section = \".modinfo\")]
+-                #[used]
++                #[used(compiler)]
+                 pub static __{module}_{counter}: [u8; {length}] = *{string};
+             ",
+             cfg = if builtin {
+@@ -247,7 +247,7 @@ pub(crate) fn module(ts: TokenStream) ->
+                     // key or a new section. For the moment, keep it simple.
+                     #[cfg(MODULE)]
+                     #[doc(hidden)]
+-                    #[used]
++                    #[used(compiler)]
+                     static __IS_RUST_MODULE: () = ();
+                     static mut __MOD: core::mem::MaybeUninit<{type_}> =
+@@ -271,7 +271,7 @@ pub(crate) fn module(ts: TokenStream) ->
+                     #[cfg(MODULE)]
+                     #[doc(hidden)]
+-                    #[used]
++                    #[used(compiler)]
+                     #[link_section = \".init.data\"]
+                     static __UNIQUE_ID___addressable_init_module: unsafe extern \"C\" fn() -> i32 = init_module;
+@@ -291,7 +291,7 @@ pub(crate) fn module(ts: TokenStream) ->
+                     #[cfg(MODULE)]
+                     #[doc(hidden)]
+-                    #[used]
++                    #[used(compiler)]
+                     #[link_section = \".exit.data\"]
+                     static __UNIQUE_ID___addressable_cleanup_module: extern \"C\" fn() = cleanup_module;
+@@ -301,7 +301,7 @@ pub(crate) fn module(ts: TokenStream) ->
+                     #[cfg(not(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS))]
+                     #[doc(hidden)]
+                     #[link_section = \"{initcall_section}\"]
+-                    #[used]
++                    #[used(compiler)]
+                     pub static __{name}_initcall: extern \"C\" fn() -> kernel::ffi::c_int = __{name}_init;
+                     #[cfg(not(MODULE))]
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -222,7 +222,7 @@ $(obj)/%.lst: $(obj)/%.c FORCE
+ # Compile Rust sources (.rs)
+ # ---------------------------------------------------------------------------
+-rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op
++rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op,used_with_arg
+ # `--out-dir` is required to avoid temporaries being created by `rustc` in the
+ # current working directory, which may be not accessible in the out-of-tree
index dd8e636297c6f331df720bfa9fa0279786cc0338..6ec7cf1e96cf26c2a1ef1e0557a134259d456786 100644 (file)
@@ -169,3 +169,5 @@ usb-hub-fix-flushing-and-scheduling-of-delayed-work-that-tunes-runtime-pm.patch
 usb-hub-fix-flushing-of-delayed-work-used-for-post-resume-purposes.patch
 usb-hub-don-t-try-to-recover-devices-lost-during-warm-reset.patch
 usb-dwc3-qcom-don-t-leave-bcr-asserted.patch
+net-libwx-fix-multicast-packets-received-count.patch
+rust-use-to-fix-build-and-modpost-with-rust-1.89.0.patch