[RFC PATCH v1 1/1] tracing/uprobe: Add missing filter for uretprobe
From: Tianyi Liu <hidden>
Date: 2024-08-22 17:40:59
Subsystem:
the rest, tracing · Maintainers:
Linus Torvalds, Steven Rostedt, Masami Hiramatsu
From: Tianyi Liu <hidden>
Date: 2024-08-22 17:40:59
Subsystem:
the rest, tracing · Maintainers:
Linus Torvalds, Steven Rostedt, Masami Hiramatsu
U(ret)probes are designed to be filterable using the PID, which is the
second parameter in the perf_event_open syscall. Currently, uprobe works
well with the filtering, but uretprobe is not affected by it. This patch
adds the missing filter for uretprobe to make it work with the PID filter.
Fixes: c1ae5c75e103 ("uprobes/tracing: Introduce is_ret_probe() and uretprobe_dispatcher()")
Cc: Alban Crequy <redacted>
Signed-off-by: Francis Laniel <redacted>
Signed-off-by: Tianyi Liu <redacted>
---
kernel/trace/trace_uprobe.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c98e3b3386ba..c7e2a0962928 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c@@ -1443,6 +1443,9 @@ static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, struct pt_regs *regs, struct uprobe_cpu_buffer **ucbp) { + if (!uprobe_perf_filter(&tu->consumer, 0, current->mm)) + return; + __uprobe_perf_func(tu, func, regs, ucbp); }
--
2.34.1