From 4bd9cb6c4e0f3b57de7d5b45add3c2887674ceff Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 17 Dec 2024 10:07:36 +0100 Subject: [PATCH] 5.4-stable patches added patches: tracing-kprobes-skip-symbol-counting-logic-for-module-symbols-in-create_local_trace_kprobe.patch --- queue-5.4/series | 1 + ...symbols-in-create_local_trace_kprobe.patch | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 queue-5.4/tracing-kprobes-skip-symbol-counting-logic-for-module-symbols-in-create_local_trace_kprobe.patch diff --git a/queue-5.4/series b/queue-5.4/series index 6b2a044015f..37cf7ac90c0 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -19,3 +19,4 @@ blk-iocost-clamp-inuse-and-skip-noops-in-__propagate.patch blk-iocost-fix-weight-updates-of-inner-active-iocgs.patch blk-iocost-avoid-using-clamp-on-inuse-in-__propagate.patch kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch +tracing-kprobes-skip-symbol-counting-logic-for-module-symbols-in-create_local_trace_kprobe.patch diff --git a/queue-5.4/tracing-kprobes-skip-symbol-counting-logic-for-module-symbols-in-create_local_trace_kprobe.patch b/queue-5.4/tracing-kprobes-skip-symbol-counting-logic-for-module-symbols-in-create_local_trace_kprobe.patch new file mode 100644 index 00000000000..8db66be0630 --- /dev/null +++ b/queue-5.4/tracing-kprobes-skip-symbol-counting-logic-for-module-symbols-in-create_local_trace_kprobe.patch @@ -0,0 +1,42 @@ +From kniv@yandex-team.ru Tue Dec 17 09:59:08 2024 +From: Nikolay Kuratov +Date: Mon, 16 Dec 2024 14:19:23 +0300 +Subject: tracing/kprobes: Skip symbol counting logic for module symbols in create_local_trace_kprobe() +To: stable@vger.kernel.org +Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Masami Hiramatsu , Francis Laniel , Steven Rostedt , Mathieu Desnoyers , Nikolay Kuratov +Message-ID: <20241216111923.2547104-1-kniv@yandex-team.ru> + +From: Nikolay Kuratov + +commit b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols") +avoids checking number_of_same_symbols() for module symbol in +__trace_kprobe_create(), but create_local_trace_kprobe() should avoid this +check too. Doing this check leads to ENOENT for module_name:symbol_name +constructions passed over perf_event_open. + +No bug in newer kernels as it was fixed more generally by +commit 9d8616034f16 ("tracing/kprobes: Add symbol counting check when module loads") + +Link: https://lore.kernel.org/linux-trace-kernel/20240705161030.b3ddb33a8167013b9b1da202@kernel.org +Fixes: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols") +Signed-off-by: Nikolay Kuratov +Signed-off-by: Greg Kroah-Hartman +--- +v1 -> v2: + * Reword commit title and message + * Send for stable instead of mainline + + kernel/trace/trace_kprobe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -1663,7 +1663,7 @@ create_local_trace_kprobe(char *func, vo + int ret; + char *event; + +- if (func) { ++ if (func && !strchr(func, ':')) { + unsigned int count; + + count = number_of_same_symbols(func); -- 2.47.3