Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ia64: kprobes: Fix to pass correct trampoline address to the handler

The following commit:

Commit e792ff804f49 ("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: e792ff804f49 ("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>

authored by

Masami Hiramatsu and committed by
Steven Rostedt (VMware)
a7fe2378 29e8077a

+5 -4
+5 -4
arch/ia64/kernel/kprobes.c
··· 398 398 399 399 int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 400 400 { 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); 402 403 /* 403 404 * By returning a non-zero value, we are telling 404 405 * kprobe_handler() that we don't want the post_handler ··· 415 414 ri->fp = NULL; 416 415 417 416 /* Replace the return addr with trampoline addr */ 418 - regs->b0 = ((struct fnptr *)kretprobe_trampoline)->ip; 417 + regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline); 419 418 } 420 419 421 420 /* Check the instruction in the slot is break */ ··· 903 902 int __init arch_init_kprobes(void) 904 903 { 905 904 trampoline_p.addr = 906 - (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; 905 + dereference_function_descriptor(kretprobe_trampoline); 907 906 return register_kprobe(&trampoline_p); 908 907 } 909 908 910 909 int __kprobes arch_trampoline_kprobe(struct kprobe *p) 911 910 { 912 911 if (p->addr == 913 - (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip) 912 + dereference_function_descriptor(kretprobe_trampoline)) 914 913 return 1; 915 914 916 915 return 0;