From: Greg Kroah-Hartman Date: Thu, 23 Jul 2026 10:20:17 +0000 (+0200) Subject: 6.12-stable patches X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=505a15d72a5945a9d2b95f405c08b1dfcba9be53;p=thirdparty%2Fkernel%2Fstable-queue.git 6.12-stable patches added patches: selftests-bpf-add-simple-strscpy-implementation.patch tools-testing-add-linux-args.h-header-and-fix-radix-vma-tests.patch --- diff --git a/queue-6.12/net-ethernet-oa_tc6-remove-fcs-size-in-rx-frame.patch b/queue-6.12/net-ethernet-oa_tc6-remove-fcs-size-in-rx-frame.patch index 6f2698115f..bfd686fa25 100644 --- a/queue-6.12/net-ethernet-oa_tc6-remove-fcs-size-in-rx-frame.patch +++ b/queue-6.12/net-ethernet-oa_tc6-remove-fcs-size-in-rx-frame.patch @@ -29,7 +29,7 @@ Signed-off-by: Sasha Levin --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c -@@ -751,6 +751,17 @@ static int oa_tc6_process_rx_chunk_foote +@@ -752,6 +752,17 @@ static int oa_tc6_process_rx_chunk_foote static void oa_tc6_submit_rx_skb(struct oa_tc6 *tc6) { diff --git a/queue-6.12/selftests-bpf-add-simple-strscpy-implementation.patch b/queue-6.12/selftests-bpf-add-simple-strscpy-implementation.patch new file mode 100644 index 0000000000..7dae61b648 --- /dev/null +++ b/queue-6.12/selftests-bpf-add-simple-strscpy-implementation.patch @@ -0,0 +1,141 @@ +From stable+bounces-288213-greg=kroah.com@vger.kernel.org Thu Jul 23 09:20:03 2026 +From: Shung-Hsi Yu +Date: Thu, 23 Jul 2026 15:13:32 +0800 +Subject: selftests/bpf: Add simple strscpy() implementation +To: stable@vger.kernel.org +Cc: Shung-Hsi Yu , Lorenzo Stoakes , Jann Horn , John Hubbard , Liam Howlett , Sidhartha Kumar , Vlastimil Babka , Dan Williams , Peter Zijlstra , Andrew Morton , Ihor Solodrai , Alexei Starovoitov +Message-ID: <20260723071334.39630-2-shung-hsi.yu@suse.com> + +From: Ihor Solodrai + +commit 63c49efc987afefc6b9bb7de083eb8748e0b1789 upstream. + +Replace bpf_strlcpy() in bpf_util.h with a sized_strscpy(), which is a +simplified sized_strscpy() from the kernel (lib/string.c [1]). It: + * takes a count (destination size) parameter + * guarantees NULL-termination + * returns the number of characters copied or -E2BIG + +Re-define strscpy macro similar to in-kernel implementation [2]: allow +the count parameter to be optional. + +Add #ifdef-s to tools/include/linux/args.h, as they may be defined in +other system headers (for example, __CONCAT in sys/cdefs.h). + +Fixup the single existing bpf_strlcpy() call in cgroup_helpers.c + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/string.c?h=v6.19#n113 +[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/string.h?h=v6.19#n91 + +Signed-off-by: Ihor Solodrai +Link: https://lore.kernel.org/r/20260223190736.649171-2-ihor.solodrai@linux.dev +Signed-off-by: Alexei Starovoitov +Stable-dep-of: 55ffbe8a15b1 ("selftests/bpf: Initialize operation name before use") +Closes: https://lore.kernel.org/stable/al8dSv_OvhwxFCar@u94a +Signed-off-by: Shung-Hsi Yu +Signed-off-by: Greg Kroah-Hartman +--- +Confirmed that BPF selftests successfully builds on 6.12[1] and 6.6[2] +after this patchset is applied. + +1: https://github.com/kernel-patches/linux-stable/actions/runs/29986297264 +2: https://github.com/kernel-patches/linux-stable/actions/runs/29987147891/ +Signed-off-by: Greg Kroah-Hartman +--- + tools/include/linux/args.h | 4 ++ + tools/testing/selftests/bpf/bpf_util.h | 45 +++++++++++++++++++-------- + tools/testing/selftests/bpf/cgroup_helpers.c | 2 - + 3 files changed, 37 insertions(+), 14 deletions(-) + +--- a/tools/include/linux/args.h ++++ b/tools/include/linux/args.h +@@ -22,7 +22,11 @@ + #define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + + /* Concatenate two parameters, but allow them to be expanded beforehand. */ ++#ifndef __CONCAT + #define __CONCAT(a, b) a ## b ++#endif ++#ifndef CONCATENATE + #define CONCATENATE(a, b) __CONCAT(a, b) ++#endif + + #endif /* _LINUX_ARGS_H */ +--- a/tools/testing/selftests/bpf/bpf_util.h ++++ b/tools/testing/selftests/bpf/bpf_util.h +@@ -8,6 +8,7 @@ + #include + #include + #include /* libbpf_num_possible_cpus */ ++#include + + static inline unsigned int bpf_num_possible_cpus(void) + { +@@ -21,25 +22,43 @@ static inline unsigned int bpf_num_possi + return possible_cpus; + } + +-/* Copy up to sz - 1 bytes from zero-terminated src string and ensure that dst +- * is zero-terminated string no matter what (unless sz == 0, in which case +- * it's a no-op). It's conceptually close to FreeBSD's strlcpy(), but differs +- * in what is returned. Given this is internal helper, it's trivial to extend +- * this, when necessary. Use this instead of strncpy inside libbpf source code. ++/* ++ * Simplified strscpy() implementation. The kernel one is in lib/string.c + */ +-static inline void bpf_strlcpy(char *dst, const char *src, size_t sz) ++static inline ssize_t sized_strscpy(char *dest, const char *src, size_t count) + { +- size_t i; ++ long res = 0; + +- if (sz == 0) +- return; ++ if (count == 0) ++ return -E2BIG; + +- sz--; +- for (i = 0; i < sz && src[i]; i++) +- dst[i] = src[i]; +- dst[i] = '\0'; ++ while (count > 1) { ++ char c; ++ ++ c = src[res]; ++ dest[res] = c; ++ if (!c) ++ return res; ++ res++; ++ count--; ++ } ++ ++ /* Force NUL-termination. */ ++ dest[res] = '\0'; ++ ++ /* Return E2BIG if the source didn't stop */ ++ return src[res] ? -E2BIG : res; + } + ++#define __strscpy0(dst, src, ...) \ ++ sized_strscpy(dst, src, sizeof(dst)) ++#define __strscpy1(dst, src, size) \ ++ sized_strscpy(dst, src, size) ++ ++#undef strscpy /* Redefine the placeholder from tools/include/linux/string.h */ ++#define strscpy(dst, src, ...) \ ++ CONCATENATE(__strscpy, COUNT_ARGS(__VA_ARGS__))(dst, src, __VA_ARGS__) ++ + #define __bpf_percpu_val_align __attribute__((__aligned__(8))) + + #define BPF_DECLARE_PERCPU(type, name) \ +--- a/tools/testing/selftests/bpf/cgroup_helpers.c ++++ b/tools/testing/selftests/bpf/cgroup_helpers.c +@@ -85,7 +85,7 @@ static int __enable_controllers(const ch + enable[len] = 0; + close(fd); + } else { +- bpf_strlcpy(enable, controllers, sizeof(enable)); ++ strscpy(enable, controllers); + } + + snprintf(path, sizeof(path), "%s/cgroup.subtree_control", cgroup_path); diff --git a/queue-6.12/series b/queue-6.12/series index 3aa99386f9..cf8749225d 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -1199,3 +1199,5 @@ bluetooth-l2cap-fix-regressions-caused-by-reusing-ident.patch bluetooth-6lowpan-fix-using-chan-conn-as-indication-to-no-remote-netdev.patch bluetooth-l2cap-fix-tx-ident-leak-for-commands-without-a-response.patch dpll-fix-null-pointer-dereference-in-dpll_msg_add_pin_ref_sync.patch +tools-testing-add-linux-args.h-header-and-fix-radix-vma-tests.patch +selftests-bpf-add-simple-strscpy-implementation.patch diff --git a/queue-6.12/tools-testing-add-linux-args.h-header-and-fix-radix-vma-tests.patch b/queue-6.12/tools-testing-add-linux-args.h-header-and-fix-radix-vma-tests.patch new file mode 100644 index 0000000000..d3a5d9ab0c --- /dev/null +++ b/queue-6.12/tools-testing-add-linux-args.h-header-and-fix-radix-vma-tests.patch @@ -0,0 +1,80 @@ +From stable+bounces-288212-greg=kroah.com@vger.kernel.org Thu Jul 23 09:15:47 2026 +From: Shung-Hsi Yu +Date: Thu, 23 Jul 2026 15:13:31 +0800 +Subject: tools/testing: add linux/args.h header and fix radix, VMA tests +To: stable@vger.kernel.org +Cc: Shung-Hsi Yu , Lorenzo Stoakes , Jann Horn , John Hubbard , Liam Howlett , Sidhartha Kumar , Vlastimil Babka , Dan Williams , Peter Zijlstra , Andrew Morton +Message-ID: <20260723071334.39630-1-shung-hsi.yu@suse.com> + +From: Lorenzo Stoakes + +commit 9a6a6a3191574a01dcf7a7d9385246d7bc8736bc upstream. + +Commit 857d18f23ab1 ("cleanup: Introduce ACQUIRE() and ACQUIRE_ERR() for +conditional locks") accidentally broke the radix tree, VMA userland tests +by including linux/args.h which is not present in the tools/include +directory. + +This patch copies this over and adds an #ifdef block to avoid duplicate +__CONCAT declaration in conflict with system headers when we ultimately +include this. + +Link: https://lkml.kernel.org/r/20250811052654.33286-1-lorenzo.stoakes@oracle.com +Fixes: 857d18f23ab1 ("cleanup: Introduce ACQUIRE() and ACQUIRE_ERR() for conditional locks") +Signed-off-by: Lorenzo Stoakes +Cc: Jann Horn +Cc: John Hubbard +Cc: Liam Howlett +Cc: Sidhartha Kumar +Cc: Vlastimil Babka +Cc: Dan Williams +Cc: Peter Zijlstra +Signed-off-by: Andrew Morton +Stable-dep-of: 63c49efc987a ("selftests/bpf: Add simple strscpy() implementation") +Signed-off-by: Shung-Hsi Yu +Signed-off-by: Greg Kroah-Hartman +--- + tools/include/linux/args.h | 28 ++++++++++++++++++++++++++++ + tools/testing/shared/linux/idr.h | 4 ++++ + 2 files changed, 32 insertions(+) + create mode 100644 tools/include/linux/args.h + +--- /dev/null ++++ b/tools/include/linux/args.h +@@ -0,0 +1,28 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++ ++#ifndef _LINUX_ARGS_H ++#define _LINUX_ARGS_H ++ ++/* ++ * How do these macros work? ++ * ++ * In __COUNT_ARGS() _0 to _12 are just placeholders from the start ++ * in order to make sure _n is positioned over the correct number ++ * from 12 to 0 (depending on X, which is a variadic argument list). ++ * They serve no purpose other than occupying a position. Since each ++ * macro parameter must have a distinct identifier, those identifiers ++ * are as good as any. ++ * ++ * In COUNT_ARGS() we use actual integers, so __COUNT_ARGS() returns ++ * that as _n. ++ */ ++ ++/* This counts to 15. Any more, it will return 16th argument. */ ++#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _n, X...) _n ++#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) ++ ++/* Concatenate two parameters, but allow them to be expanded beforehand. */ ++#define __CONCAT(a, b) a ## b ++#define CONCATENATE(a, b) __CONCAT(a, b) ++ ++#endif /* _LINUX_ARGS_H */ +--- a/tools/testing/shared/linux/idr.h ++++ b/tools/testing/shared/linux/idr.h +@@ -1 +1,5 @@ ++/* Avoid duplicate definitions due to system headers. */ ++#ifdef __CONCAT ++#undef __CONCAT ++#endif + #include "../../../../include/linux/idr.h"