* [PATCH v2] tracing/fprobe: Fix to check whether fprobe is registered correctly
@ 2022-10-26 9:33 Masami Hiramatsu (Google)
0 siblings, 0 replies; only message in thread
From: Masami Hiramatsu (Google) @ 2022-10-26 9:33 UTC (permalink / raw)
To: LKML; +Cc: Linux Trace Kernel, Masami Hiramatsu, Steven Rostedt, Jiri Olsa
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Since commit ab51e15d535e ("fprobe: Introduce FPROBE_FL_KPROBE_SHARED flag
for fprobe") introduced fprobe_kprobe_handler() for fprobe::ops::func,
unregister_fprobe() fails to unregister the registered if user specifies
FPROBE_FL_KPROBE_SHARED flag.
Moreover, __register_ftrace_function() is possible to change the
ftrace_ops::func, thus we have to check fprobe::ops::saved_func instead.
To check it correctly, it should confirm the fprobe::ops::saved_func is
either fprobe_handler() or fprobe_kprobe_handler().
Fixes: cad9931f64dc ("fprobe: Add ftrace based probe APIs")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/fprobe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index 71614b2a67ff..e8143e368074 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -303,7 +303,8 @@ int unregister_fprobe(struct fprobe *fp)
{
int ret;
- if (!fp || fp->ops.func != fprobe_handler)
+ if (!fp || (fp->ops.saved_func != fprobe_handler &&
+ fp->ops.saved_func != fprobe_kprobe_handler))
return -EINVAL;
/*
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-26 9:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-26 9:33 [PATCH v2] tracing/fprobe: Fix to check whether fprobe is registered correctly Masami Hiramatsu (Google)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.