]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2025 13:41:14 +0000 (14:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2025 13:41:14 +0000 (14:41 +0100)
added patches:
libbpf-fix-invalid-return-address-register-in-s390.patch
libbpf-fix-riscv-register-names.patch
libbpf-riscv-use-a0-for-rc-register.patch
selftests-bpf-don-t-rely-on-preserving-volatile-in-pt_regs-macros-in-loop3.patch

queue-5.15/libbpf-fix-invalid-return-address-register-in-s390.patch [new file with mode: 0644]
queue-5.15/libbpf-fix-riscv-register-names.patch [new file with mode: 0644]
queue-5.15/libbpf-riscv-use-a0-for-rc-register.patch [new file with mode: 0644]
queue-5.15/selftests-bpf-don-t-rely-on-preserving-volatile-in-pt_regs-macros-in-loop3.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/libbpf-fix-invalid-return-address-register-in-s390.patch b/queue-5.15/libbpf-fix-invalid-return-address-register-in-s390.patch
new file mode 100644 (file)
index 0000000..9a990e5
--- /dev/null
@@ -0,0 +1,37 @@
+From 7244eb669397f309c3d014264823cdc9cb3f8e6b Mon Sep 17 00:00:00 2001
+From: "Daniel T. Lee" <danieltimlee@gmail.com>
+Date: Sat, 24 Dec 2022 16:15:27 +0900
+Subject: libbpf: Fix invalid return address register in s390
+
+From: Daniel T. Lee <danieltimlee@gmail.com>
+
+commit 7244eb669397f309c3d014264823cdc9cb3f8e6b upstream.
+
+There is currently an invalid register mapping in the s390 return
+address register. As the manual[1] states, the return address can be
+found at r14. In bpf_tracing.h, the s390 registers were named
+gprs(general purpose registers). This commit fixes the problem by
+correcting the mistyped mapping.
+
+[1]: https://uclibc.org/docs/psABI-s390x.pdf#page=14
+
+Fixes: 3cc31d794097 ("libbpf: Normalize PT_REGS_xxx() macro definitions")
+Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Link: https://lore.kernel.org/bpf/20221224071527.2292-7-danieltimlee@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/lib/bpf/bpf_tracing.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/lib/bpf/bpf_tracing.h
++++ b/tools/lib/bpf/bpf_tracing.h
+@@ -119,7 +119,7 @@
+ #define __PT_PARM3_REG gprs[4]
+ #define __PT_PARM4_REG gprs[5]
+ #define __PT_PARM5_REG gprs[6]
+-#define __PT_RET_REG grps[14]
++#define __PT_RET_REG gprs[14]
+ #define __PT_FP_REG gprs[11]  /* Works only with CONFIG_FRAME_POINTER */
+ #define __PT_RC_REG gprs[2]
+ #define __PT_SP_REG gprs[15]
diff --git a/queue-5.15/libbpf-fix-riscv-register-names.patch b/queue-5.15/libbpf-fix-riscv-register-names.patch
new file mode 100644 (file)
index 0000000..d8e70f9
--- /dev/null
@@ -0,0 +1,37 @@
+From 5c101153bfd67387ba159b7864176217a40757da Mon Sep 17 00:00:00 2001
+From: Ilya Leoshkevich <iii@linux.ibm.com>
+Date: Wed, 9 Feb 2022 03:17:40 +0100
+Subject: libbpf: Fix riscv register names
+
+From: Ilya Leoshkevich <iii@linux.ibm.com>
+
+commit 5c101153bfd67387ba159b7864176217a40757da upstream.
+
+riscv registers are accessed via struct user_regs_struct, not struct
+pt_regs. The program counter member in this struct is called pc, not
+epc. The frame pointer is called s0, not fp.
+
+Fixes: 3cc31d794097 ("libbpf: Normalize PT_REGS_xxx() macro definitions")
+Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Link: https://lore.kernel.org/bpf/20220209021745.2215452-6-iii@linux.ibm.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/lib/bpf/bpf_tracing.h |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tools/lib/bpf/bpf_tracing.h
++++ b/tools/lib/bpf/bpf_tracing.h
+@@ -206,10 +206,10 @@
+ #define __PT_PARM4_REG a3
+ #define __PT_PARM5_REG a4
+ #define __PT_RET_REG ra
+-#define __PT_FP_REG fp
++#define __PT_FP_REG s0
+ #define __PT_RC_REG a5
+ #define __PT_SP_REG sp
+-#define __PT_IP_REG epc
++#define __PT_IP_REG pc
+ #endif
diff --git a/queue-5.15/libbpf-riscv-use-a0-for-rc-register.patch b/queue-5.15/libbpf-riscv-use-a0-for-rc-register.patch
new file mode 100644 (file)
index 0000000..e849696
--- /dev/null
@@ -0,0 +1,41 @@
+From 935dc35c75318fa213d26808ad8bb130fb0b486e Mon Sep 17 00:00:00 2001
+From: Yixun Lan <dlan@gentoo.org>
+Date: Wed, 6 Jul 2022 22:02:04 +0800
+Subject: libbpf, riscv: Use a0 for RC register
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Yixun Lan <dlan@gentoo.org>
+
+commit 935dc35c75318fa213d26808ad8bb130fb0b486e upstream.
+
+According to the RISC-V calling convention register usage here [0], a0
+is used as return value register, so rename it to make it consistent
+with the spec.
+
+  [0] section 18.2, table 18.2
+      https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf
+
+Fixes: 589fed479ba1 ("riscv, libbpf: Add RISC-V (RV64) support to bpf_tracing.h")
+Signed-off-by: Yixun Lan <dlan@gentoo.org>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Acked-by: Björn Töpel <bjorn@kernel.org>
+Acked-by: Amjad OULED-AMEUR <ouledameur.amjad@gmail.com>
+Link: https://lore.kernel.org/bpf/20220706140204.47926-1-dlan@gentoo.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/lib/bpf/bpf_tracing.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/lib/bpf/bpf_tracing.h
++++ b/tools/lib/bpf/bpf_tracing.h
+@@ -207,7 +207,7 @@
+ #define __PT_PARM5_REG a4
+ #define __PT_RET_REG ra
+ #define __PT_FP_REG s0
+-#define __PT_RC_REG a5
++#define __PT_RC_REG a0
+ #define __PT_SP_REG sp
+ #define __PT_IP_REG pc
diff --git a/queue-5.15/selftests-bpf-don-t-rely-on-preserving-volatile-in-pt_regs-macros-in-loop3.patch b/queue-5.15/selftests-bpf-don-t-rely-on-preserving-volatile-in-pt_regs-macros-in-loop3.patch
new file mode 100644 (file)
index 0000000..71e2581
--- /dev/null
@@ -0,0 +1,42 @@
+From 70bc793382a0e37ba4e35e4d1a317b280b829a44 Mon Sep 17 00:00:00 2001
+From: Andrii Nakryiko <andrii@kernel.org>
+Date: Thu, 6 Jan 2022 12:51:56 -0800
+Subject: selftests/bpf: Don't rely on preserving volatile in PT_REGS macros in loop3
+
+From: Andrii Nakryiko <andrii@kernel.org>
+
+commit 70bc793382a0e37ba4e35e4d1a317b280b829a44 upstream.
+
+PT_REGS*() macro on some architectures force-cast struct pt_regs to
+other types (user_pt_regs, etc) and might drop volatile modifiers, if any.
+Volatile isn't really required as pt_regs value isn't supposed to change
+during the BPF program run, so this is correct behavior.
+
+But progs/loop3.c relies on that volatile modifier to ensure that loop
+is preserved. Fix loop3.c by declaring i and sum variables as volatile
+instead. It preserves the loop and makes the test pass on all
+architectures (including s390x which is currently broken).
+
+Fixes: 3cc31d794097 ("libbpf: Normalize PT_REGS_xxx() macro definitions")
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Link: https://lore.kernel.org/bpf/20220106205156.955373-1-andrii@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/bpf/progs/loop3.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tools/testing/selftests/bpf/progs/loop3.c
++++ b/tools/testing/selftests/bpf/progs/loop3.c
+@@ -12,9 +12,9 @@
+ char _license[] SEC("license") = "GPL";
+ SEC("raw_tracepoint/consume_skb")
+-int while_true(volatile struct pt_regs* ctx)
++int while_true(struct pt_regs *ctx)
+ {
+-      __u64 i = 0, sum = 0;
++      volatile __u64 i = 0, sum = 0;
+       do {
+               i++;
+               sum += PT_REGS_RC(ctx);
index 17d906fb2f07df87241ef476b555f0c9f4d2b717..a1bc0caa2a4e436cf15a39665769b297c2a2dcd3 100644 (file)
@@ -388,3 +388,7 @@ usb-renesas_usbhs-fix-synchronous-external-abort-on-unbind.patch
 usb-typec-ucsi-psy-set-max-current-to-zero-when-disconnected.patch
 bluetooth-add-more-enc-key-size-check.patch
 scsi-pm80xx-set-phy-enable_completion-only-when-we.patch
+selftests-bpf-don-t-rely-on-preserving-volatile-in-pt_regs-macros-in-loop3.patch
+libbpf-fix-riscv-register-names.patch
+libbpf-riscv-use-a0-for-rc-register.patch
+libbpf-fix-invalid-return-address-register-in-s390.patch