[PATCH v4 0/9] fprobe: Introduce fprobe function entry/exit probe

From: Masami Hiramatsu
Date: Mon Jan 24 2022 - 11:09:57 EST


Hello Jiri,

Here is the 4th version of fprobe. I fixed some issues on fprobe
and rethook. I dropped out-of-tree patches and Jiri's bpf patch
and add rethook arm/arm64 support and fprobe documentation.
The previous version is here[1];

[1] https://lore.kernel.org/all/164260419349.657731.13913104835063027148.stgit@devnote2/T/#u

The biggest change of this version is supporting ftrace location
conversion correctly. Previous version can not find ftrace location
if the dynamic ftrace nop is not placed a the symbol address.

This series introduces the fprobe, the function entry/exit probe
with multiple probe point support. This also introduces the rethook
for hooking function return as same as kretprobe does. This
abstraction will help us to generalize the fgraph tracer,
because we can just switch it from rethook in fprobe, depending
on the kernel configuration.

The patch [1/9] is from Jiri's series[2].

[2] https://lore.kernel.org/all/20220104080943.113249-1-jolsa@xxxxxxxxxx/T/#u

I'll continue porting rethook to other archs, and after that replace
the current kretprobe with the rethook. This design change will make
the fgraph/kretprobe integration easier because if fgraph is not available,
kretprobe can use rethook.


Thank you,

---

Jiri Olsa (1):
ftrace: Add ftrace_set_filter_ips function

Masami Hiramatsu (8):
fprobe: Add ftrace based probe APIs
rethook: Add a generic return hook
rethook: x86: Add rethook x86 implementation
ARM: rethook: Add rethook arm implementation
arm64: rethook: Add arm64 rethook implementation
fprobe: Add exit_handler support
fprobe: Add sample program for fprobe
docs: fprobe: Add fprobe description to ftrace-use.rst


Documentation/trace/fprobe.rst | 131 +++++++++++
Documentation/trace/index.rst | 1
arch/arm/Kconfig | 1
arch/arm/kernel/stacktrace.c | 4
arch/arm/probes/Makefile | 1
arch/arm/probes/rethook.c | 71 ++++++
arch/arm64/Kconfig | 1
arch/arm64/kernel/probes/Makefile | 1
arch/arm64/kernel/probes/rethook.c | 25 ++
arch/arm64/kernel/probes/rethook_trampoline.S | 87 +++++++
arch/arm64/kernel/stacktrace.c | 3
arch/x86/Kconfig | 1
arch/x86/include/asm/unwind.h | 4
arch/x86/kernel/Makefile | 1
arch/x86/kernel/rethook.c | 115 +++++++++
include/linux/fprobe.h | 86 +++++++
include/linux/ftrace.h | 3
include/linux/rethook.h | 99 ++++++++
include/linux/sched.h | 3
kernel/exit.c | 2
kernel/fork.c | 3
kernel/trace/Kconfig | 24 ++
kernel/trace/Makefile | 2
kernel/trace/fprobe.c | 198 ++++++++++++++++
kernel/trace/ftrace.c | 53 ++++
kernel/trace/rethook.c | 311 +++++++++++++++++++++++++
samples/Kconfig | 7 +
samples/Makefile | 1
samples/fprobe/Makefile | 3
samples/fprobe/fprobe_example.c | 103 ++++++++
30 files changed, 1336 insertions(+), 9 deletions(-)
create mode 100644 Documentation/trace/fprobe.rst
create mode 100644 arch/arm/probes/rethook.c
create mode 100644 arch/arm64/kernel/probes/rethook.c
create mode 100644 arch/arm64/kernel/probes/rethook_trampoline.S
create mode 100644 arch/x86/kernel/rethook.c
create mode 100644 include/linux/fprobe.h
create mode 100644 include/linux/rethook.h
create mode 100644 kernel/trace/fprobe.c
create mode 100644 kernel/trace/rethook.c
create mode 100644 samples/fprobe/Makefile
create mode 100644 samples/fprobe/fprobe_example.c

--
Masami Hiramatsu (Linaro) <mhiramat@xxxxxxxxxx>