s390/kprobes: enable kretprobes framepointer verification

Use regs->gprs[15] for framepointer verification. This enables
additional sanity checks for nested kretprobes.

Reviewed-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Vasily Gorbik 2022-03-05 15:02:07 +01:00
parent 0b45252047
commit 09bc20c8fb
1 changed files with 4 additions and 4 deletions

View File

@ -284,11 +284,11 @@ NOKPROBE_SYMBOL(pop_kprobe);
void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs)
{ {
ri->ret_addr = (kprobe_opcode_t *) regs->gprs[14]; ri->ret_addr = (kprobe_opcode_t *)regs->gprs[14];
ri->fp = NULL; ri->fp = (void *)regs->gprs[15];
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->gprs[14] = (unsigned long) &__kretprobe_trampoline; regs->gprs[14] = (unsigned long)&__kretprobe_trampoline;
} }
NOKPROBE_SYMBOL(arch_prepare_kretprobe); NOKPROBE_SYMBOL(arch_prepare_kretprobe);
@ -385,7 +385,7 @@ NOKPROBE_SYMBOL(arch_kretprobe_fixup_return);
*/ */
void trampoline_probe_handler(struct pt_regs *regs) void trampoline_probe_handler(struct pt_regs *regs)
{ {
kretprobe_trampoline_handler(regs, NULL); kretprobe_trampoline_handler(regs, (void *)regs->gprs[15]);
} }
NOKPROBE_SYMBOL(trampoline_probe_handler); NOKPROBE_SYMBOL(trampoline_probe_handler);