diff mbox series

[RFC,v1,1/1] tracing/uprobe: Add missing filter for uretprobe

Message ID ME0P300MB0416CAC1E33697C3EF5971989D8F2@ME0P300MB0416.AUSP300.PROD.OUTLOOK.COM (mailing list archive)
State Superseded
Headers show
Series tracing/uprobe: Add missing filter for uretprobe | expand

Commit Message

Tianyi Liu Aug. 22, 2024, 5:40 p.m. UTC
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 <albancrequy@linux.microsoft.com>
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
Signed-off-by: Tianyi Liu <i.pear@outlook.com>
---
 kernel/trace/trace_uprobe.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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);
 }