bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes
@ 2020-06-08 12:45 Jean-Philippe Brucker
  2020-06-08 15:24 ` Yonghong Song
  2020-06-09  7:12 ` Masami Hiramatsu
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Philippe Brucker @ 2020-06-08 12:45 UTC (permalink / raw)
  To: linux-kernel, bpf
  Cc: mhiramat, rostedt, mingo, ast, daniel, kafai, songliubraving,
	yhs, andriin, john.fastabend, kpsingh, Jean-Philippe Brucker

Commit 60d53e2c3b75 ("tracing/probe: Split trace_event related data from
trace_probe") removed the trace_[ku]probe structure from the
trace_event_call->data pointer. As bpf_get_[ku]probe_info() were
forgotten in that change, fix them now. These functions are currently
only used by the bpf_task_fd_query() syscall handler to collect
information about a perf event.

Fixes: 60d53e2c3b75 ("tracing/probe: Split trace_event related data from trace_probe")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
Found while trying to run the task_fd_query BPF sample. I intend to try
and move that sample to kselftests since it seems like a useful
regression test.
---
 kernel/trace/trace_kprobe.c | 2 +-
 kernel/trace/trace_uprobe.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 35989383ae113..8eeb95e04bf52 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1629,7 +1629,7 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type,
 	if (perf_type_tracepoint)
 		tk = find_trace_kprobe(pevent, group);
 	else
-		tk = event->tp_event->data;
+		tk = trace_kprobe_primary_from_call(event->tp_event);
 	if (!tk)
 		return -EINVAL;
 
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 2a8e8e9c1c754..fdd47f99b18fd 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -1412,7 +1412,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type,
 	if (perf_type_tracepoint)
 		tu = find_probe_event(pevent, group);
 	else
-		tu = event->tp_event->data;
+		tu = trace_uprobe_primary_from_call(event->tp_event);
 	if (!tu)
 		return -EINVAL;
 
-- 
2.27.0


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

* Re: [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes
  2020-06-08 12:45 [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes Jean-Philippe Brucker
@ 2020-06-08 15:24 ` Yonghong Song
  2020-06-09  7:12 ` Masami Hiramatsu
  1 sibling, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2020-06-08 15:24 UTC (permalink / raw)
  To: Jean-Philippe Brucker, linux-kernel, bpf
  Cc: mhiramat, rostedt, mingo, ast, daniel, kafai, songliubraving,
	andriin, john.fastabend, kpsingh


On 6/8/20 5:45 AM, Jean-Philippe Brucker wrote:
> Commit 60d53e2c3b75 ("tracing/probe: Split trace_event related data from
> trace_probe") removed the trace_[ku]probe structure from the
> trace_event_call->data pointer. As bpf_get_[ku]probe_info() were
> forgotten in that change, fix them now. These functions are currently
> only used by the bpf_task_fd_query() syscall handler to collect
> information about a perf event.
>
> Fixes: 60d53e2c3b75 ("tracing/probe: Split trace_event related data from trace_probe")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>

Thanks for the fix.

Acked-by: Yonghong Song <yhs@fb.com>


> ---
> Found while trying to run the task_fd_query BPF sample. I intend to try
> and move that sample to kselftests since it seems like a useful
> regression test.

That will be great. Thanks!


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

* Re: [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes
  2020-06-08 12:45 [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes Jean-Philippe Brucker
  2020-06-08 15:24 ` Yonghong Song
@ 2020-06-09  7:12 ` Masami Hiramatsu
  2020-06-09 18:18   ` Alexei Starovoitov
  1 sibling, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2020-06-09  7:12 UTC (permalink / raw)
  To: Jean-Philippe Brucker
  Cc: linux-kernel, bpf, mhiramat, rostedt, mingo, ast, daniel, kafai,
	songliubraving, yhs, andriin, john.fastabend, kpsingh

On Mon,  8 Jun 2020 14:45:32 +0200
Jean-Philippe Brucker <jean-philippe@linaro.org> wrote:

> Commit 60d53e2c3b75 ("tracing/probe: Split trace_event related data from
> trace_probe") removed the trace_[ku]probe structure from the
> trace_event_call->data pointer. As bpf_get_[ku]probe_info() were
> forgotten in that change, fix them now. These functions are currently
> only used by the bpf_task_fd_query() syscall handler to collect
> information about a perf event.
> 

Oops, good catch!

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>


> Fixes: 60d53e2c3b75 ("tracing/probe: Split trace_event related data from trace_probe")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>

Cc: stable@vger.kernel.org


Thank you!

> ---
> Found while trying to run the task_fd_query BPF sample. I intend to try
> and move that sample to kselftests since it seems like a useful
> regression test.
> ---
>  kernel/trace/trace_kprobe.c | 2 +-
>  kernel/trace/trace_uprobe.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 35989383ae113..8eeb95e04bf52 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1629,7 +1629,7 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type,
>  	if (perf_type_tracepoint)
>  		tk = find_trace_kprobe(pevent, group);
>  	else
> -		tk = event->tp_event->data;
> +		tk = trace_kprobe_primary_from_call(event->tp_event);
>  	if (!tk)
>  		return -EINVAL;
>  
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 2a8e8e9c1c754..fdd47f99b18fd 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -1412,7 +1412,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type,
>  	if (perf_type_tracepoint)
>  		tu = find_probe_event(pevent, group);
>  	else
> -		tu = event->tp_event->data;
> +		tu = trace_uprobe_primary_from_call(event->tp_event);
>  	if (!tu)
>  		return -EINVAL;
>  
> -- 
> 2.27.0
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes
  2020-06-09  7:12 ` Masami Hiramatsu
@ 2020-06-09 18:18   ` Alexei Starovoitov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2020-06-09 18:18 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Jean-Philippe Brucker, LKML, bpf, Steven Rostedt, Ingo Molnar,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh

On Tue, Jun 9, 2020 at 12:12 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> On Mon,  8 Jun 2020 14:45:32 +0200
> Jean-Philippe Brucker <jean-philippe@linaro.org> wrote:
>
> > Commit 60d53e2c3b75 ("tracing/probe: Split trace_event related data from
> > trace_probe") removed the trace_[ku]probe structure from the
> > trace_event_call->data pointer. As bpf_get_[ku]probe_info() were
> > forgotten in that change, fix them now. These functions are currently
> > only used by the bpf_task_fd_query() syscall handler to collect
> > information about a perf event.
> >
>
> Oops, good catch!
>
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
>
>
> > Fixes: 60d53e2c3b75 ("tracing/probe: Split trace_event related data from trace_probe")
> > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
>
> Cc: stable@vger.kernel.org

Applied to bpf tree. Thanks

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

end of thread, other threads:[~2020-06-09 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 12:45 [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes Jean-Philippe Brucker
2020-06-08 15:24 ` Yonghong Song
2020-06-09  7:12 ` Masami Hiramatsu
2020-06-09 18:18   ` Alexei Starovoitov

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).