[PATCH -tip 0/4] kprobes: Support __kprobes and NOKPROBE_SYMBOL in modules

From: Masami Hiramatsu
Date: Thu Mar 26 2020 - 10:49:33 EST


Hi,

Here is a series for adding support of __kprobes attribute
and NOKPROBE_SYMBOL() macro in modules. With this series,
kprobes user can add its handlers and sub-functions to kprobe
blacklist so that other kprobes don't probe it.

Note that user should not use both __kprobes and NOKPROBE_SYMBOL()
to same function. In that case, the function will appear twice
on the blacklist, and that is a waste of memory.

Thomas, it is easy to add ".noinstr.text" support to this series.
as same as __kprobes (.kprobes.text) support in [2/4], we can
add mod->noinstr_text_start and mod->noinstr_text_size and
register it in add_module_kprobe_blacklist().


Thank you,

---

Masami Hiramatsu (4):
kprobes: Lock kprobe_mutex while showing kprobe_blacklist
kprobes: Support __kprobes blacklist in modules
kprobes: Support NOKPROBE_SYMBOL() in modules
samples/kprobes: Add __kprobes and NOKPROBE_SYMBOL() for handlers.


include/linux/module.h | 6 +++
kernel/kprobes.c | 67 ++++++++++++++++++++++++++++++++++-
kernel/module.c | 7 ++++
samples/kprobes/kprobe_example.c | 6 ++-
samples/kprobes/kretprobe_example.c | 2 +
5 files changed, 85 insertions(+), 3 deletions(-)

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