On Mon, 14 Jun 2021 21:16:26 +0530 "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxx> wrote: > Hi Masami, > > Masami Hiramatsu wrote: > > Remove trampoline_address from kretprobe_trampoline_handler(). > > Instead of passing the address, kretprobe_trampoline_handler() > > can use new kretprobe_trampoline_addr(). > > > > Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> > > Tested-by: Andrii Nakryik <andrii@xxxxxxxxxx> > > --- > > Changes in v3: > > - Remove wrong kretprobe_trampoline declaration from > > arch/x86/include/asm/kprobes.h. > > Changes in v2: > > - Remove arch_deref_entry_point() from comment. > > --- > > arch/arc/kernel/kprobes.c | 2 +- > > arch/arm/probes/kprobes/core.c | 3 +-- > > arch/arm64/kernel/probes/kprobes.c | 3 +-- > > arch/csky/kernel/probes/kprobes.c | 2 +- > > arch/ia64/kernel/kprobes.c | 5 ++--- > > arch/mips/kernel/kprobes.c | 3 +-- > > arch/parisc/kernel/kprobes.c | 4 ++-- > > arch/powerpc/kernel/kprobes.c | 2 +- > > arch/riscv/kernel/probes/kprobes.c | 2 +- > > arch/s390/kernel/kprobes.c | 2 +- > > arch/sh/kernel/kprobes.c | 2 +- > > arch/sparc/kernel/kprobes.c | 2 +- > > arch/x86/include/asm/kprobes.h | 1 - > > arch/x86/kernel/kprobes/core.c | 2 +- > > include/linux/kprobes.h | 18 +++++++++++++----- > > kernel/kprobes.c | 3 +-- > > 16 files changed, 29 insertions(+), 27 deletions(-) > > > > <snip> > > > diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h > > index d65c041b5c22..65dadd4238a2 100644 > > --- a/include/linux/kprobes.h > > +++ b/include/linux/kprobes.h > > @@ -205,15 +205,23 @@ extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, > > struct pt_regs *regs); > > extern int arch_trampoline_kprobe(struct kprobe *p); > > > > +void kretprobe_trampoline(void); > > +/* > > + * Since some architecture uses structured function pointer, > > + * use dereference_function_descriptor() to get real function address. > > + */ > > +static nokprobe_inline void *kretprobe_trampoline_addr(void) > > +{ > > + return dereference_function_descriptor(kretprobe_trampoline); > > I'm afraid this won't work correctly. For kernel functions, please use > dereference_kernel_function_descriptor() which checks if the function > has a descriptor before dereferencing it. Oops, there is *kernel_function* version, I didn't notice that. Thank you for reviewing! I'll fix that. > > > Thanks, > Naveen > -- Masami Hiramatsu <mhiramat@xxxxxxxxxx>