linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] tracing/kprobes: Skip symbol counting logic for module symbols in create_local_trace_kprobe()
@ 2024-12-16 16:11 Nikolay Kuratov
  2024-12-19  1:17 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Kuratov @ 2024-12-16 16:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, linux-trace-kernel, Masami Hiramatsu,
	Francis Laniel, Steven Rostedt, Mathieu Desnoyers,
	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 mainline and 6.12 as those contain more general fix
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 <kniv@yandex-team.ru>
---
v1 -> v2:
 * Reword commit title and message
 * Send for stable instead of mainline
v2 -> v3:
 * Specify first good LTS version in commit message
 * Remove explicit versions from the subject since 6.1 and 5.10 need fix too

 kernel/trace/trace_kprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 12d997bb3e78..94cb09d44115 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1814,7 +1814,7 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
 	int ret;
 	char *event;
 
-	if (func) {
+	if (func && !strchr(func, ':')) {
 		unsigned int count;
 
 		count = number_of_same_symbols(func);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] tracing/kprobes: Skip symbol counting logic for module symbols in create_local_trace_kprobe()
  2024-12-16 16:11 [PATCH v3] tracing/kprobes: Skip symbol counting logic for module symbols in create_local_trace_kprobe() Nikolay Kuratov
@ 2024-12-19  1:17 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2024-12-19  1:17 UTC (permalink / raw)
  To: Nikolay Kuratov
  Cc: stable, linux-kernel, linux-trace-kernel, Masami Hiramatsu,
	Francis Laniel, Steven Rostedt, Mathieu Desnoyers

On Mon, 16 Dec 2024 19:11:45 +0300
Nikolay Kuratov <kniv@yandex-team.ru> wrote:

> 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 mainline and 6.12 as those contain more general fix
> commit 9d8616034f16 ("tracing/kprobes: Add symbol counting check when module loads")

Thanks! It seems Greg already queued v2 for stable kernels, and
it seems no theoletical change in this version.

Thank you,

> 
> 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 <kniv@yandex-team.ru>
> ---
> v1 -> v2:
>  * Reword commit title and message
>  * Send for stable instead of mainline
> v2 -> v3:
>  * Specify first good LTS version in commit message
>  * Remove explicit versions from the subject since 6.1 and 5.10 need fix too
> 
>  kernel/trace/trace_kprobe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 12d997bb3e78..94cb09d44115 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1814,7 +1814,7 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
>  	int ret;
>  	char *event;
>  
> -	if (func) {
> +	if (func && !strchr(func, ':')) {
>  		unsigned int count;
>  
>  		count = number_of_same_symbols(func);
> -- 
> 2.34.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-19  1:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 16:11 [PATCH v3] tracing/kprobes: Skip symbol counting logic for module symbols in create_local_trace_kprobe() Nikolay Kuratov
2024-12-19  1:17 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).