]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jun 2025 14:04:55 +0000 (16:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jun 2025 14:04:55 +0000 (16:04 +0200)
added patches:
ipv6-remove-leftover-ip6-cookie-initializer.patch
ipv6-replace-ipcm6_init-calls-with-ipcm6_init_sk.patch
kunit-to-check-the-longest-symbol-length.patch
x86-tools-drop-duplicate-unlikely-definition-in-insn_decoder_test.c.patch

queue-6.12/ipv6-remove-leftover-ip6-cookie-initializer.patch [new file with mode: 0644]
queue-6.12/ipv6-replace-ipcm6_init-calls-with-ipcm6_init_sk.patch [new file with mode: 0644]
queue-6.12/kunit-to-check-the-longest-symbol-length.patch [new file with mode: 0644]
queue-6.12/series
queue-6.12/x86-tools-drop-duplicate-unlikely-definition-in-insn_decoder_test.c.patch [new file with mode: 0644]

diff --git a/queue-6.12/ipv6-remove-leftover-ip6-cookie-initializer.patch b/queue-6.12/ipv6-remove-leftover-ip6-cookie-initializer.patch
new file mode 100644 (file)
index 0000000..e523001
--- /dev/null
@@ -0,0 +1,42 @@
+From 54580ccdd8a9c6821fd6f72171d435480867e4c3 Mon Sep 17 00:00:00 2001
+From: Willem de Bruijn <willemb@google.com>
+Date: Thu, 6 Mar 2025 22:34:08 -0500
+Subject: ipv6: remove leftover ip6 cookie initializer
+
+From: Willem de Bruijn <willemb@google.com>
+
+commit 54580ccdd8a9c6821fd6f72171d435480867e4c3 upstream.
+
+As of the blamed commit ipc6.dontfrag is always initialized at the
+start of udpv6_sendmsg, by ipcm6_init_sk, to either 0 or 1.
+
+Later checks against -1 are no longer needed and the branches are now
+dead code.
+
+The blamed commit had removed those branches. But I had overlooked
+this one case.
+
+UDP has both a lockless fast path and a slower path for corked
+requests. This branch remained in the fast path.
+
+Fixes: 096208592b09 ("ipv6: replace ipcm6_init calls with ipcm6_init_sk")
+Signed-off-by: Willem de Bruijn <willemb@google.com>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Link: https://patch.msgid.link/20250307033620.411611-2-willemdebruijn.kernel@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/ip6_output.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/net/ipv6/ip6_output.c
++++ b/net/ipv6/ip6_output.c
+@@ -2043,8 +2043,6 @@ struct sk_buff *ip6_make_skb(struct sock
+               ip6_cork_release(cork, &v6_cork);
+               return ERR_PTR(err);
+       }
+-      if (ipc6->dontfrag < 0)
+-              ipc6->dontfrag = inet6_test_bit(DONTFRAG, sk);
+       err = __ip6_append_data(sk, &queue, cork, &v6_cork,
+                               &current->task_frag, getfrag, from,
diff --git a/queue-6.12/ipv6-replace-ipcm6_init-calls-with-ipcm6_init_sk.patch b/queue-6.12/ipv6-replace-ipcm6_init-calls-with-ipcm6_init_sk.patch
new file mode 100644 (file)
index 0000000..6766823
--- /dev/null
@@ -0,0 +1,139 @@
+From 096208592b09c2f5fc0c1a174694efa41c04209d Mon Sep 17 00:00:00 2001
+From: Willem de Bruijn <willemb@google.com>
+Date: Fri, 14 Feb 2025 17:27:03 -0500
+Subject: ipv6: replace ipcm6_init calls with ipcm6_init_sk
+
+From: Willem de Bruijn <willemb@google.com>
+
+commit 096208592b09c2f5fc0c1a174694efa41c04209d upstream.
+
+This initializes tclass and dontfrag before cmsg parsing, removing the
+need for explicit checks against -1 in each caller.
+
+Leave hlimit set to -1, because its full initialization
+(in ip6_sk_dst_hoplimit) requires more state (dst, flowi6, ..).
+
+This also prepares for calling sockcm_init in a follow-on patch.
+
+Signed-off-by: Willem de Bruijn <willemb@google.com>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Link: https://patch.msgid.link/20250214222720.3205500-7-willemdebruijn.kernel@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/net/ipv6.h  |    9 ---------
+ net/ipv6/raw.c      |    8 +-------
+ net/ipv6/udp.c      |    7 +------
+ net/l2tp/l2tp_ip6.c |    8 +-------
+ 4 files changed, 3 insertions(+), 29 deletions(-)
+
+--- a/include/net/ipv6.h
++++ b/include/net/ipv6.h
+@@ -363,15 +363,6 @@ struct ipcm6_cookie {
+       struct ipv6_txoptions *opt;
+ };
+-static inline void ipcm6_init(struct ipcm6_cookie *ipc6)
+-{
+-      *ipc6 = (struct ipcm6_cookie) {
+-              .hlimit = -1,
+-              .tclass = -1,
+-              .dontfrag = -1,
+-      };
+-}
+-
+ static inline void ipcm6_init_sk(struct ipcm6_cookie *ipc6,
+                                const struct sock *sk)
+ {
+--- a/net/ipv6/raw.c
++++ b/net/ipv6/raw.c
+@@ -777,7 +777,7 @@ static int rawv6_sendmsg(struct sock *sk
+       fl6.flowi6_mark = READ_ONCE(sk->sk_mark);
+       fl6.flowi6_uid = sk->sk_uid;
+-      ipcm6_init(&ipc6);
++      ipcm6_init_sk(&ipc6, sk);
+       ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
+       ipc6.sockc.mark = fl6.flowi6_mark;
+@@ -890,9 +890,6 @@ static int rawv6_sendmsg(struct sock *sk
+       if (hdrincl)
+               fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH;
+-      if (ipc6.tclass < 0)
+-              ipc6.tclass = np->tclass;
+-
+       fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
+       dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
+@@ -903,9 +900,6 @@ static int rawv6_sendmsg(struct sock *sk
+       if (ipc6.hlimit < 0)
+               ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
+-      if (ipc6.dontfrag < 0)
+-              ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
+-
+       if (msg->msg_flags&MSG_CONFIRM)
+               goto do_confirm;
+--- a/net/ipv6/udp.c
++++ b/net/ipv6/udp.c
+@@ -1399,7 +1399,7 @@ int udpv6_sendmsg(struct sock *sk, struc
+       int is_udplite = IS_UDPLITE(sk);
+       int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
+-      ipcm6_init(&ipc6);
++      ipcm6_init_sk(&ipc6, sk);
+       ipc6.gso_size = READ_ONCE(up->gso_size);
+       ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
+       ipc6.sockc.mark = READ_ONCE(sk->sk_mark);
+@@ -1608,9 +1608,6 @@ do_udp_sendmsg:
+       security_sk_classify_flow(sk, flowi6_to_flowi_common(fl6));
+-      if (ipc6.tclass < 0)
+-              ipc6.tclass = np->tclass;
+-
+       fl6->flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6->flowlabel);
+       dst = ip6_sk_dst_lookup_flow(sk, fl6, final_p, connected);
+@@ -1656,8 +1653,6 @@ back_from_confirm:
+       WRITE_ONCE(up->pending, AF_INET6);
+ do_append_data:
+-      if (ipc6.dontfrag < 0)
+-              ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
+       up->len += ulen;
+       err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr),
+                             &ipc6, fl6, dst_rt6_info(dst),
+--- a/net/l2tp/l2tp_ip6.c
++++ b/net/l2tp/l2tp_ip6.c
+@@ -547,7 +547,7 @@ static int l2tp_ip6_sendmsg(struct sock
+       fl6.flowi6_mark = READ_ONCE(sk->sk_mark);
+       fl6.flowi6_uid = sk->sk_uid;
+-      ipcm6_init(&ipc6);
++      ipcm6_init_sk(&ipc6, sk);
+       if (lsa) {
+               if (addr_len < SIN6_LEN_RFC2133)
+@@ -634,9 +634,6 @@ static int l2tp_ip6_sendmsg(struct sock
+       security_sk_classify_flow(sk, flowi6_to_flowi_common(&fl6));
+-      if (ipc6.tclass < 0)
+-              ipc6.tclass = np->tclass;
+-
+       fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
+       dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
+@@ -648,9 +645,6 @@ static int l2tp_ip6_sendmsg(struct sock
+       if (ipc6.hlimit < 0)
+               ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
+-      if (ipc6.dontfrag < 0)
+-              ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
+-
+       if (msg->msg_flags & MSG_CONFIRM)
+               goto do_confirm;
diff --git a/queue-6.12/kunit-to-check-the-longest-symbol-length.patch b/queue-6.12/kunit-to-check-the-longest-symbol-length.patch
new file mode 100644 (file)
index 0000000..2b1dd56
--- /dev/null
@@ -0,0 +1,183 @@
+From c104c16073b7fdb3e4eae18f66f4009f6b073d6f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Sergio=20Gonz=C3=A1lez=20Collado?=
+ <sergio.collado@gmail.com>
+Date: Sun, 2 Mar 2025 23:15:18 +0100
+Subject: Kunit to check the longest symbol length
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Sergio González Collado <sergio.collado@gmail.com>
+
+commit c104c16073b7fdb3e4eae18f66f4009f6b073d6f upstream.
+
+The longest length of a symbol (KSYM_NAME_LEN) was increased to 512
+in the reference [1]. This patch adds kunit test suite to check the longest
+symbol length. These tests verify that the longest symbol length defined
+is supported.
+
+This test can also help other efforts for longer symbol length,
+like [2].
+
+The test suite defines one symbol with the longest possible length.
+
+The first test verify that functions with names of the created
+symbol, can be called or not.
+
+The second test, verify that the symbols are created (or
+not) in the kernel symbol table.
+
+[1] https://lore.kernel.org/lkml/20220802015052.10452-6-ojeda@kernel.org/
+[2] https://lore.kernel.org/lkml/20240605032120.3179157-1-song@kernel.org/
+
+Link: https://lore.kernel.org/r/20250302221518.76874-1-sergio.collado@gmail.com
+Tested-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
+Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
+Reviewed-by: Rae Moar <rmoar@google.com>
+Signed-off-by: Sergio González Collado <sergio.collado@gmail.com>
+Link: https://github.com/Rust-for-Linux/linux/issues/504
+Reviewed-by: Rae Moar <rmoar@google.com>
+Acked-by: David Gow <davidgow@google.com>
+Signed-off-by: Shuah Khan <shuah@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/tools/insn_decoder_test.c |    3 -
+ lib/Kconfig.debug                  |    9 ++++
+ lib/Makefile                       |    2 
+ lib/longest_symbol_kunit.c         |   82 +++++++++++++++++++++++++++++++++++++
+ 4 files changed, 95 insertions(+), 1 deletion(-)
+ create mode 100644 lib/longest_symbol_kunit.c
+
+--- a/arch/x86/tools/insn_decoder_test.c
++++ b/arch/x86/tools/insn_decoder_test.c
+@@ -10,6 +10,7 @@
+ #include <assert.h>
+ #include <unistd.h>
+ #include <stdarg.h>
++#include <linux/kallsyms.h>
+ #define unlikely(cond) (cond)
+@@ -106,7 +107,7 @@ static void parse_args(int argc, char **
+       }
+ }
+-#define BUFSIZE 256
++#define BUFSIZE (256 + KSYM_NAME_LEN)
+ int main(int argc, char **argv)
+ {
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -2807,6 +2807,15 @@ config FORTIFY_KUNIT_TEST
+         by the str*() and mem*() family of functions. For testing runtime
+         traps of FORTIFY_SOURCE, see LKDTM's "FORTIFY_*" tests.
++config LONGEST_SYM_KUNIT_TEST
++      tristate "Test the longest symbol possible" if !KUNIT_ALL_TESTS
++      depends on KUNIT && KPROBES
++      default KUNIT_ALL_TESTS
++      help
++        Tests the longest symbol possible
++
++        If unsure, say N.
++
+ config HW_BREAKPOINT_KUNIT_TEST
+       bool "Test hw_breakpoint constraints accounting" if !KUNIT_ALL_TESTS
+       depends on HAVE_HW_BREAKPOINT
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -389,6 +389,8 @@ CFLAGS_fortify_kunit.o += $(DISABLE_STRU
+ obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o
+ obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o
+ obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o
++obj-$(CONFIG_LONGEST_SYM_KUNIT_TEST) += longest_symbol_kunit.o
++CFLAGS_longest_symbol_kunit.o += $(call cc-disable-warning, missing-prototypes)
+ obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
+--- /dev/null
++++ b/lib/longest_symbol_kunit.c
+@@ -0,0 +1,82 @@
++// SPDX-License-Identifier: GPL-2.0
++/*
++ * Test the longest symbol length. Execute with:
++ *  ./tools/testing/kunit/kunit.py run longest-symbol
++ *  --arch=x86_64 --kconfig_add CONFIG_KPROBES=y --kconfig_add CONFIG_MODULES=y
++ *  --kconfig_add CONFIG_RETPOLINE=n --kconfig_add CONFIG_CFI_CLANG=n
++ *  --kconfig_add CONFIG_MITIGATION_RETPOLINE=n
++ */
++
++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++
++#include <kunit/test.h>
++#include <linux/stringify.h>
++#include <linux/kprobes.h>
++#include <linux/kallsyms.h>
++
++#define DI(name) s##name##name
++#define DDI(name) DI(n##name##name)
++#define DDDI(name) DDI(n##name##name)
++#define DDDDI(name) DDDI(n##name##name)
++#define DDDDDI(name) DDDDI(n##name##name)
++
++/*Generate a symbol whose name length is 511 */
++#define LONGEST_SYM_NAME  DDDDDI(g1h2i3j4k5l6m7n)
++
++#define RETURN_LONGEST_SYM 0xAAAAA
++
++noinline int LONGEST_SYM_NAME(void);
++noinline int LONGEST_SYM_NAME(void)
++{
++      return RETURN_LONGEST_SYM;
++}
++
++_Static_assert(sizeof(__stringify(LONGEST_SYM_NAME)) == KSYM_NAME_LEN,
++"Incorrect symbol length found. Expected KSYM_NAME_LEN: "
++__stringify(KSYM_NAME_LEN) ", but found: "
++__stringify(sizeof(LONGEST_SYM_NAME)));
++
++static void test_longest_symbol(struct kunit *test)
++{
++      KUNIT_EXPECT_EQ(test, RETURN_LONGEST_SYM, LONGEST_SYM_NAME());
++};
++
++static void test_longest_symbol_kallsyms(struct kunit *test)
++{
++      unsigned long (*kallsyms_lookup_name)(const char *name);
++      static int (*longest_sym)(void);
++
++      struct kprobe kp = {
++              .symbol_name = "kallsyms_lookup_name",
++      };
++
++      if (register_kprobe(&kp) < 0) {
++              pr_info("%s: kprobe not registered", __func__);
++              KUNIT_FAIL(test, "test_longest_symbol kallsyms: kprobe not registered\n");
++              return;
++      }
++
++      kunit_warn(test, "test_longest_symbol kallsyms: kprobe registered\n");
++      kallsyms_lookup_name = (unsigned long (*)(const char *name))kp.addr;
++      unregister_kprobe(&kp);
++
++      longest_sym =
++              (void *) kallsyms_lookup_name(__stringify(LONGEST_SYM_NAME));
++      KUNIT_EXPECT_EQ(test, RETURN_LONGEST_SYM, longest_sym());
++};
++
++static struct kunit_case longest_symbol_test_cases[] = {
++      KUNIT_CASE(test_longest_symbol),
++      KUNIT_CASE(test_longest_symbol_kallsyms),
++      {}
++};
++
++static struct kunit_suite longest_symbol_test_suite = {
++      .name = "longest-symbol",
++      .test_cases = longest_symbol_test_cases,
++};
++kunit_test_suite(longest_symbol_test_suite);
++
++MODULE_LICENSE("GPL");
++MODULE_DESCRIPTION("Test the longest symbol length");
++MODULE_AUTHOR("Sergio González Collado");
index 8ed3ff77d86d929b13a1e8748b84d400b2b94fbc..49647357f37fe083f8025f33b5d380386c03af1c 100644 (file)
@@ -345,3 +345,7 @@ erofs-remove-unused-trace-event-erofs_destroy_inode.patch
 nfsd-use-threads-array-as-is-in-netlink-interface.patch
 sunrpc-handle-svc_garbage-during-svc-auth-processing-as-auth-error.patch
 drm-v3d-avoid-null-pointer-dereference-in-v3d_job_update_stats.patch
+kunit-to-check-the-longest-symbol-length.patch
+x86-tools-drop-duplicate-unlikely-definition-in-insn_decoder_test.c.patch
+ipv6-remove-leftover-ip6-cookie-initializer.patch
+ipv6-replace-ipcm6_init-calls-with-ipcm6_init_sk.patch
diff --git a/queue-6.12/x86-tools-drop-duplicate-unlikely-definition-in-insn_decoder_test.c.patch b/queue-6.12/x86-tools-drop-duplicate-unlikely-definition-in-insn_decoder_test.c.patch
new file mode 100644 (file)
index 0000000..c142803
--- /dev/null
@@ -0,0 +1,40 @@
+From f710202b2a45addea3dcdcd862770ecbaf6597ef Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Tue, 18 Mar 2025 15:32:30 -0700
+Subject: x86/tools: Drop duplicate unlikely() definition in insn_decoder_test.c
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit f710202b2a45addea3dcdcd862770ecbaf6597ef upstream.
+
+After commit c104c16073b7 ("Kunit to check the longest symbol length"),
+there is a warning when building with clang because there is now a
+definition of unlikely from compiler.h in tools/include/linux, which
+conflicts with the one in the instruction decoder selftest:
+
+  arch/x86/tools/insn_decoder_test.c:15:9: warning: 'unlikely' macro redefined [-Wmacro-redefined]
+
+Remove the second unlikely() definition, as it is no longer necessary,
+clearing up the warning.
+
+Fixes: c104c16073b7 ("Kunit to check the longest symbol length")
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Acked-by: Shuah Khan <skhan@linuxfoundation.org>
+Link: https://lore.kernel.org/r/20250318-x86-decoder-test-fix-unlikely-redef-v1-1-74c84a7bf05b@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/tools/insn_decoder_test.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/arch/x86/tools/insn_decoder_test.c
++++ b/arch/x86/tools/insn_decoder_test.c
+@@ -12,8 +12,6 @@
+ #include <stdarg.h>
+ #include <linux/kallsyms.h>
+-#define unlikely(cond) (cond)
+-
+ #include <asm/insn.h>
+ #include <inat.c>
+ #include <insn.c>