diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2022-03-15 23:01:48 +0900 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-03-17 20:16:52 -0700 |
commit | 5b0ab78998e32564a011b14c4c7f9c81e2d42b9d (patch) | |
tree | 96ec6ca183dafa1165d4d17392f2d9b1ba9cda10 /include/linux/fprobe.h | |
parent | 515a49173b80a4aabcbad9a4fa2a247042378ea1 (diff) |
fprobe: Add exit_handler support
Add exit_handler to fprobe. fprobe + rethook allows us to hook the kernel
function return. The rethook will be enabled only if the
fprobe::exit_handler is set.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Tested-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/164735290790.1084943.10601965782208052202.stgit@devnote2
Diffstat (limited to 'include/linux/fprobe.h')
-rw-r--r-- | include/linux/fprobe.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/fprobe.h b/include/linux/fprobe.h index 2ba099aff041..8eefec2b485e 100644 --- a/include/linux/fprobe.h +++ b/include/linux/fprobe.h @@ -5,13 +5,16 @@ #include <linux/compiler.h> #include <linux/ftrace.h> +#include <linux/rethook.h> /** * struct fprobe - ftrace based probe. * @ops: The ftrace_ops. * @nmissed: The counter for missing events. * @flags: The status flag. + * @rethook: The rethook data structure. (internal data) * @entry_handler: The callback function for function entry. + * @exit_handler: The callback function for function exit. */ struct fprobe { #ifdef CONFIG_FUNCTION_TRACER @@ -25,7 +28,10 @@ struct fprobe { #endif unsigned long nmissed; unsigned int flags; + struct rethook *rethook; + void (*entry_handler)(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs); + void (*exit_handler)(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs); }; #define FPROBE_FL_DISABLED 1 |