[PATCH v2 00/15] kprobes: Unify kretprobe trampoline handlers
From: Masami Hiramatsu
Date: Thu Aug 27 2020 - 07:46:41 EST
Hi,
Here is the 2nd version of the series to unify the kretprobe trampoline handler
implementation across all architectures which are currently kprobes supported.
Previous version is here;
https://lkml.kernel.org/r/159844957216.510284.17683703701627367133.stgit@devnote2
This series removes the in_nmi() check from pre_kretprobe_handler() since we
can avoid double-lock deadlock from NMI by kprobe_busy_begin/end().
In this version, I also add a patch to use kfree_rcu() for freeing kretprobe
instance objects so that we don't call kfree() in NMI context directly.
The unified generic kretprobe trampoline handler is based on x86 code, which
already support frame-pointer checker. The checker is enabled on arm and arm64
too because I can test it. For other architecutres, currently the checker
is not enabled. If someone wants to enable it, please set the correct
frame pointer to ri->fp and pass it to kretprobe_trampoline_handler() as the
3rd parameter, instead of NULL.
Thank you,
---
Masami Hiramatsu (15):
kprobes: Add generic kretprobe trampoline handler
x86/kprobes: Use generic kretprobe trampoline handler
arm: kprobes: Use generic kretprobe trampoline handler
arm64: kprobes: Use generic kretprobe trampoline handler
arc: kprobes: Use generic kretprobe trampoline handler
csky: kprobes: Use generic kretprobe trampoline handler
ia64: kprobes: Use generic kretprobe trampoline handler
mips: kprobes: Use generic kretprobe trampoline handler
parisc: kprobes: Use generic kretprobe trampoline handler
powerpc: kprobes: Use generic kretprobe trampoline handler
s390: kprobes: Use generic kretprobe trampoline handler
sh: kprobes: Use generic kretprobe trampoline handler
sparc: kprobes: Use generic kretprobe trampoline handler
kprobes: Remove NMI context check
kprobes: Free kretprobe_instance with rcu callback
arch/arc/kernel/kprobes.c | 55 +---------------
arch/arm/probes/kprobes/core.c | 79 +----------------------
arch/arm64/kernel/probes/kprobes.c | 79 +----------------------
arch/csky/kernel/probes/kprobes.c | 78 +---------------------
arch/ia64/kernel/kprobes.c | 79 +----------------------
arch/mips/kernel/kprobes.c | 55 +---------------
arch/parisc/kernel/kprobes.c | 78 ++--------------------
arch/powerpc/kernel/kprobes.c | 55 +---------------
arch/s390/kernel/kprobes.c | 81 +----------------------
arch/sh/kernel/kprobes.c | 59 +----------------
arch/sparc/kernel/kprobes.c | 52 +--------------
arch/x86/kernel/kprobes/core.c | 109 +------------------------------
include/linux/kprobes.h | 35 +++++++++-
kernel/kprobes.c | 126 +++++++++++++++++++++++++++++-------
14 files changed, 182 insertions(+), 838 deletions(-)
--
Masami Hiramatsu (Linaro) <mhiramat@xxxxxxxxxx>