tracing/fprobe: Fix to check whether fprobe is registered correctly
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Sun, 23 Oct 2022 02:11:43 +0000 (11:11 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 3 Nov 2022 23:50:07 +0000 (08:50 +0900)
commit61b304b73ab4b48b1cd7796efe42a570e2a0e0fc
treeb650c933b3d1d1d6fd4212ab6ac3524f895342bc
parentd05ea35e7eea14d32f29fd688d3daeb9089de1a5
tracing/fprobe: Fix to check whether fprobe is registered correctly

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().

Link: https://lore.kernel.org/all/166677683946.1459107.15997653945538644683.stgit@devnote3/
Fixes: cad9931f64dc ("fprobe: Add ftrace based probe APIs")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
kernel/trace/fprobe.c