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 <[email protected]>
Signed-off-by: Francis Laniel <[email protected]>
Signed-off-by: Tianyi Liu <[email protected]>
---
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