s390/kprobes: Avoid additional kprobe in kretprobe handling
authorTobias Huschle <huschle@linux.ibm.com>
Mon, 21 Feb 2022 11:55:52 +0000 (12:55 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 10 Mar 2022 14:58:17 +0000 (15:58 +0100)
commit63bf38ff5bc3d8cee6c6a089657876d0b669cae1
tree7551b4e8820713493acbf93a348fecd33535504a
parent731efc9613ee073c8944d0d56616d421cf906b0b
s390/kprobes: Avoid additional kprobe in kretprobe handling

So far, s390 registered a krobe on __kretprobe_trampoline which is
called everytime a kretprobe fires. This kprobe would then determine
the correct return address and adjust the psw accordingly, such that
the kretprobe would branch to the appropriate address after completion.

Some other archs handle kretprobes without such an additional kprobe.
This approach is adopted to s390 with this patch.
Furthermore, the __kretprobe_trampoline now uses an assembler function
to correctly gather the register and psw content to be passed to the
registered kretprobe handler as struct pt_regs. After completion, the
register content and the psw are set based on the contents of said
pt_regs struct.
Note that a change to the psw address in struct pt_regs will not have
an impact, as the probe will still return to the original return
address of the probed function.
The return address is now recovered by using the appropriate function
arch_kretprobe_fixup_return.

The no longer needed kprobe is removed.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/kprobes.h
arch/s390/kernel/Makefile
arch/s390/kernel/kprobes.c
arch/s390/kernel/mcount.S