Skip to contentSkip to conversation

tracing/uprobe: Fix uprobe_perf_open probes iteration

PATCH In review Jiri Olsa 2 participants 2 messages Nov 23, 2021 – Nov 24, 2021 Tracing

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 tracing/uprobe: Fix uprobe_perf_open probes iteration

Add missing 'tu' variable initialization in the probes loop, otherwise the head 'tu' is used instead of added probes.

Fixes 99c9a923e97a ("tracing/uprobe: Fix double perf_event linking on multiprobe uprobe")
---
 kernel/trace/trace_uprobe.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_uprobe.c +1 -0
index 0a5c0db3137e..f5f0039d31e5 100644
@@ -1313,6 +1313,7 @@ static int uprobe_perf_open(struct trace_event_call *call,
 		return 0;
 
 	list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
+		tu = container_of(pos, struct trace_uprobe, tp);
 		err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true);
 		if (err) {
 			uprobe_perf_close(call, event);
Signature · 1 line
2.32.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · On Tue, 23 Nov 2021 15:28:01 +0100 Jiri Olsa <[email protected]> wrote:

Add missing 'tu' variable initialization in the probes loop, otherwise the head 'tu' is used instead of added probes.

Thanks for fixing this bug!

Quoted 22 lines
Fixes 99c9a923e97a ("tracing/uprobe: Fix double perf_event linking on multiprobe uprobe")
---
 kernel/trace/trace_uprobe.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_uprobe.c +1 -0
index 0a5c0db3137e..f5f0039d31e5 100644
@@ -1313,6 +1313,7 @@ static int uprobe_perf_open(struct trace_event_call *call,
 		return 0;
 
 	list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
+		tu = container_of(pos, struct trace_uprobe, tp);
 		err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true);
 		if (err) {
 			uprobe_perf_close(call, event);
Signature · 1 line
2.32.0
Signature · 1 line
Masami Hiramatsu <[email protected]>