From: Greg Kroah-Hartman Date: Tue, 22 Apr 2025 07:55:54 +0000 (+0200) Subject: 6.12-stable patches X-Git-Tag: v6.1.135~86 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3daa069dac6bb58b5034656e8ddba13ddd5d4f2b;p=thirdparty%2Fkernel%2Fstable-queue.git 6.12-stable patches added patches: misc-pci_endpoint_test-avoid-issue-of-interrupts-remaining-after-request_irq-error.patch misc-pci_endpoint_test-fix-irq_type-to-convey-the-correct-type.patch selftests-bpf-fix-raw_tp-null-handling-test.patch --- diff --git a/queue-6.12/misc-pci_endpoint_test-avoid-issue-of-interrupts-remaining-after-request_irq-error.patch b/queue-6.12/misc-pci_endpoint_test-avoid-issue-of-interrupts-remaining-after-request_irq-error.patch new file mode 100644 index 0000000000..d1dd19fc3b --- /dev/null +++ b/queue-6.12/misc-pci_endpoint_test-avoid-issue-of-interrupts-remaining-after-request_irq-error.patch @@ -0,0 +1,51 @@ +From f6cb7828c8e17520d4f5afb416515d3fae1af9a9 Mon Sep 17 00:00:00 2001 +From: Kunihiko Hayashi +Date: Tue, 25 Feb 2025 20:02:48 +0900 +Subject: misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kunihiko Hayashi + +commit f6cb7828c8e17520d4f5afb416515d3fae1af9a9 upstream. + +After devm_request_irq() fails with error in pci_endpoint_test_request_irq(), +the pci_endpoint_test_free_irq_vectors() is called assuming that all IRQs +have been released. + +However, some requested IRQs remain unreleased, so there are still +/proc/irq/* entries remaining, and this results in WARN() with the +following message: + + remove_proc_entry: removing non-empty directory 'irq/30', leaking at least 'pci-endpoint-test.0' + WARNING: CPU: 0 PID: 202 at fs/proc/generic.c:719 remove_proc_entry +0x190/0x19c + +To solve this issue, set the number of remaining IRQs to test->num_irqs, +and release IRQs in advance by calling pci_endpoint_test_release_irq(). + +Cc: stable@vger.kernel.org +Fixes: e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands") +Reviewed-by: Manivannan Sadhasivam +Signed-off-by: Kunihiko Hayashi +Link: https://lore.kernel.org/r/20250225110252.28866-3-hayashi.kunihiko@socionext.com +[kwilczynski: commit log] +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Kunihiko Hayashi +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/pci_endpoint_test.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/misc/pci_endpoint_test.c ++++ b/drivers/misc/pci_endpoint_test.c +@@ -251,6 +251,9 @@ fail: + break; + } + ++ test->num_irqs = i; ++ pci_endpoint_test_release_irq(test); ++ + return false; + } + diff --git a/queue-6.12/misc-pci_endpoint_test-fix-irq_type-to-convey-the-correct-type.patch b/queue-6.12/misc-pci_endpoint_test-fix-irq_type-to-convey-the-correct-type.patch new file mode 100644 index 0000000000..1f70bb4384 --- /dev/null +++ b/queue-6.12/misc-pci_endpoint_test-fix-irq_type-to-convey-the-correct-type.patch @@ -0,0 +1,65 @@ +From baaef0a274cfb75f9b50eab3ef93205e604f662c Mon Sep 17 00:00:00 2001 +From: Kunihiko Hayashi +Date: Tue, 25 Feb 2025 20:02:50 +0900 +Subject: misc: pci_endpoint_test: Fix 'irq_type' to convey the correct type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kunihiko Hayashi + +commit baaef0a274cfb75f9b50eab3ef93205e604f662c upstream. + +There are two variables that indicate the interrupt type to be used +in the next test execution, "irq_type" as global and "test->irq_type". + +The global is referenced from pci_endpoint_test_get_irq() to preserve +the current type for ioctl(PCITEST_GET_IRQTYPE). + +The type set in this function isn't reflected in the global "irq_type", +so ioctl(PCITEST_GET_IRQTYPE) returns the previous type. + +As a result, the wrong type is displayed in old version of "pcitest" +as follows: + + - Result of running "pcitest -i 0" + + SET IRQ TYPE TO LEGACY: OKAY + + - Result of running "pcitest -I" + + GET IRQ TYPE: MSI + +Whereas running the new version of "pcitest" in kselftest results in an +error as follows: + + # RUN pci_ep_basic.LEGACY_IRQ_TEST ... + # pci_endpoint_test.c:104:LEGACY_IRQ_TEST:Expected 0 (0) == ret (1) + # pci_endpoint_test.c:104:LEGACY_IRQ_TEST:Can't get Legacy IRQ type + +Fix this issue by propagating the current type to the global "irq_type". + +Fixes: b2ba9225e031 ("misc: pci_endpoint_test: Avoid using module parameter to determine irqtype") +Signed-off-by: Kunihiko Hayashi +[kwilczynski: commit log] +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Niklas Cassel +Reviewed-by: Manivannan Sadhasivam +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20250225110252.28866-5-hayashi.kunihiko@socionext.com +Signed-off-by: Kunihiko Hayashi +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/pci_endpoint_test.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/misc/pci_endpoint_test.c ++++ b/drivers/misc/pci_endpoint_test.c +@@ -741,6 +741,7 @@ static bool pci_endpoint_test_set_irq(st + if (!pci_endpoint_test_request_irq(test)) + goto err; + ++ irq_type = test->irq_type; + return true; + + err: diff --git a/queue-6.12/selftests-bpf-fix-raw_tp-null-handling-test.patch b/queue-6.12/selftests-bpf-fix-raw_tp-null-handling-test.patch new file mode 100644 index 0000000000..c89cbe40a8 --- /dev/null +++ b/queue-6.12/selftests-bpf-fix-raw_tp-null-handling-test.patch @@ -0,0 +1,85 @@ +From shung-hsi.yu@suse.com Tue Apr 22 09:44:48 2025 +From: Shung-Hsi Yu +Date: Fri, 18 Apr 2025 16:03:45 +0800 +Subject: selftests/bpf: Fix raw_tp null handling test +To: stable@vger.kernel.org, Greg Kroah-Hartman +Cc: Kumar Kartikeya Dwivedi , Eduard Zingerman , Jiri Olsa , Alexei Starovoitov , Ihor Solodrai , Shung-Hsi Yu +Message-ID: <20250418080346.37112-1-shung-hsi.yu@suse.com> + +From: Shung-Hsi Yu + +Commit b2fc4b17fc13, backport of upstream commit 838a10bd2ebf ("bpf: +Augment raw_tp arguments with PTR_MAYBE_NULL"), was missing the changes +to tools/testing/selftests/bpf/progs/raw_tp_null.c, and cause the test +to fail with the following error (see link below for the complete log) + + Error: #205 raw_tp_null + libbpf: prog 'test_raw_tp_null': BPF program load failed: Permission denied + libbpf: prog 'test_raw_tp_null': -- BEGIN PROG LOAD LOG -- + 0: R1=ctx() R10=fp0 + ; int BPF_PROG(test_raw_tp_null, struct sk_buff *skb) @ raw_tp_null.c:13 + 0: (79) r6 = *(u64 *)(r1 +0) + func 'bpf_testmod_test_raw_tp_null' arg0 has btf_id 2081 type STRUCT 'sk_buff' + 1: R1=ctx() R6_w=trusted_ptr_or_null_sk_buff(id=1) + ; struct task_struct *task = bpf_get_current_task_btf(); @ raw_tp_null.c:15 + 1: (85) call bpf_get_current_task_btf#158 ; R0_w=trusted_ptr_task_struct() + ; if (task->pid != tid) @ raw_tp_null.c:17 + 2: (61) r1 = *(u32 *)(r0 +1416) ; R0_w=trusted_ptr_task_struct() R1_w=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff)) + 3: (18) r2 = 0xffffa3bb801c6000 ; R2_w=map_value(map=raw_tp_n.bss,ks=4,vs=8) + 5: (61) r2 = *(u32 *)(r2 +0) ; R2_w=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff)) + 6: (5e) if w1 != w2 goto pc+11 ; R1_w=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff)) R2_w=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff)) + ; i = i + skb->mark + 1; @ raw_tp_null.c:20 + 7: (61) r2 = *(u32 *)(r6 +164) + R6 invalid mem access 'trusted_ptr_or_null_' + processed 7 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0 + -- END PROG LOAD LOG -- + libbpf: prog 'test_raw_tp_null': failed to load: -13 + libbpf: failed to load object 'raw_tp_null' + libbpf: failed to load BPF skeleton 'raw_tp_null': -13 + test_raw_tp_null:FAIL:raw_tp_null__open_and_load unexpected error: -13 + +Bring the missing changes in to fix the test failure. + +Link: https://github.com/shunghsiyu/libbpf/actions/runs/14522396622/job/40766998873 +Fixes: b2fc4b17fc13 ("bpf: Augment raw_tp arguments with PTR_MAYBE_NULL") +Signed-off-by: Shung-Hsi Yu +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/bpf/progs/raw_tp_null.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +--- a/tools/testing/selftests/bpf/progs/raw_tp_null.c ++++ b/tools/testing/selftests/bpf/progs/raw_tp_null.c +@@ -3,6 +3,7 @@ + + #include + #include ++#include "bpf_misc.h" + + char _license[] SEC("license") = "GPL"; + +@@ -17,16 +18,14 @@ int BPF_PROG(test_raw_tp_null, struct sk + if (task->pid != tid) + return 0; + +- i = i + skb->mark + 1; +- /* The compiler may move the NULL check before this deref, which causes +- * the load to fail as deref of scalar. Prevent that by using a barrier. ++ /* If dead code elimination kicks in, the increment +=2 will be ++ * removed. For raw_tp programs attaching to tracepoints in kernel ++ * modules, we mark input arguments as PTR_MAYBE_NULL, so branch ++ * prediction should never kick in. + */ +- barrier(); +- /* If dead code elimination kicks in, the increment below will +- * be removed. For raw_tp programs, we mark input arguments as +- * PTR_MAYBE_NULL, so branch prediction should never kick in. +- */ +- if (!skb) +- i += 2; ++ asm volatile ("%[i] += 1; if %[ctx] != 0 goto +1; %[i] += 2;" ++ : [i]"+r"(i) ++ : [ctx]"r"(skb) ++ : "memory"); + return 0; + } diff --git a/queue-6.12/series b/queue-6.12/series index 1822ce9fcb..e7cf1389fb 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -196,3 +196,6 @@ kbuild-add-fno-builtin-wcslen.patch platform-x86-msi-wmi-platform-rename-data-variable.patch platform-x86-msi-wmi-platform-workaround-a-acpi-firmware-bug.patch md-fix-mddev-uaf-while-iterating-all_mddevs-list.patch +selftests-bpf-fix-raw_tp-null-handling-test.patch +misc-pci_endpoint_test-avoid-issue-of-interrupts-remaining-after-request_irq-error.patch +misc-pci_endpoint_test-fix-irq_type-to-convey-the-correct-type.patch