Skip to content

Commit a09a5f4

Browse files
mhiramatgregkh
authored andcommitted
ia64: kprobes: Fix to pass correct trampoline address to the handler
commit a7fe237 upstream. The following commit: Commit e792ff8 ("ia64: kprobes: Use generic kretprobe trampoline handler") Passed the wrong trampoline address to __kretprobe_trampoline_handler(): it passes the descriptor address instead of function entry address. Pass the right parameter. Also use correct symbol dereference function to get the function address from 'kretprobe_trampoline' - an IA64 special. Link: https://lkml.kernel.org/r/163163042696.489837.12551102356265354730.stgit@devnote2 Fixes: e792ff8 ("ia64: kprobes: Use generic kretprobe trampoline handler") Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: X86 ML <x86@kernel.org> Cc: Daniel Xu <dxu@dxuuu.xyz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Abhishek Sagar <sagar.abhishek@gmail.com> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com> Cc: Paul McKenney <paulmck@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2f65b76 commit a09a5f4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎arch/ia64/kernel/kprobes.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ static void kretprobe_trampoline(void)
398398

399399
int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
400400
{
401-
regs->cr_iip = __kretprobe_trampoline_handler(regs, kretprobe_trampoline, NULL);
401+
regs->cr_iip = __kretprobe_trampoline_handler(regs,
402+
dereference_function_descriptor(kretprobe_trampoline), NULL);
402403
/*
403404
* By returning a non-zero value, we are telling
404405
* kprobe_handler() that we don't want the post_handler
@@ -414,7 +415,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
414415
ri->fp = NULL;
415416

416417
/* Replace the return addr with trampoline addr */
417-
regs->b0 = ((struct fnptr *)kretprobe_trampoline)->ip;
418+
regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline);
418419
}
419420

420421
/* Check the instruction in the slot is break */
@@ -918,14 +919,14 @@ static struct kprobe trampoline_p = {
918919
int __init arch_init_kprobes(void)
919920
{
920921
trampoline_p.addr =
921-
(kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip;
922+
dereference_function_descriptor(kretprobe_trampoline);
922923
return register_kprobe(&trampoline_p);
923924
}
924925

925926
int __kprobes arch_trampoline_kprobe(struct kprobe *p)
926927
{
927928
if (p->addr ==
928-
(kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip)
929+
dereference_function_descriptor(kretprobe_trampoline))
929930
return 1;
930931

931932
return 0;

0 commit comments

Comments
 (0)