[PATCH 0/8] kprobes: Make KUnit and add stacktrace on kretprobe tests

Masami Hiramatsu
2021-10-08T12:31:27Z

Hi,

Here is the series to change the kprobes selftest to KUnit and
add testcases for stacktrace on kretprobes, which has been fixed
recently on x86.

KUnit conversion work has been done by Sven. (Thanks!)
I found that if there are testcases for the stacktrace on kretprobes
we can make sure that the stacktrace can work or not while booting.
So I added 2 additinal Kunit test cases for stacktrace on kretprobe.
One is for a simple stacktrace on kretprobe, the other is for the
stacktrace with kretprobes on nested functions.

But actually, this is currently only for the x86. Thus I also added
some fixes to enable stacktrace on kretprobe on arm and arm64.

Note that for the arm, this series only supports framepointer
based stacktrace. To support ARM unwinder, will need more work.

Thank you,

---

Masami Hiramatsu (7):
kprobes: Add a test case for stacktrace from kretprobe handler
arm64: kprobes: Record frame pointer with kretprobe instance
arm64: kprobes: Make a frame pointer on __kretprobe_trampoline
arm64: Recover kretprobe modified return address in stacktrace
ARM: clang: Do not relay on lr register for stacktrace
ARM: kprobes: Make a frame pointer on __kretprobe_trampoline
ARM: Recover kretprobe modified return address in stacktrace

Sven Schnelle (1):
kprobes: convert tests to kunit

arch/Kconfig | 8 +
arch/arm/Kconfig | 1
arch/arm/include/asm/stacktrace.h | 5
arch/arm/kernel/return_address.c | 2
arch/arm/kernel/stacktrace.c | 11 +
arch/arm/probes/kprobes/core.c | 29 ++
arch/arm64/Kconfig | 1
arch/arm64/include/asm/stacktrace.h | 2
arch/arm64/kernel/probes/kprobes.c | 4
arch/arm64/kernel/probes/kprobes_trampoline.S | 4
arch/arm64/kernel/stacktrace.c | 3
arch/x86/Kconfig | 1
kernel/kprobes.c | 3
kernel/test_kprobes.c | 374 ++++++++++++++-----------
lib/Kconfig.debug | 3
15 files changed, 278 insertions(+), 173 deletions(-)

--
Masami Hiramatsu (Linaro) <mhiramat@kernel.org>