Re: [PATCH V4 03/13] kprobes: Add symbols for kprobe insn pages
From: Peter Zijlstra
Date: Tue Mar 24 2020 - 08:31:43 EST
On Wed, Mar 04, 2020 at 11:06:23AM +0200, Adrian Hunter wrote:
> Symbols are needed for tools to describe instruction addresses. Pages
> allocated for kprobe's purposes need symbols to be created for them.
> Add such symbols to be visible via /proc/kallsyms.
>
> Note: kprobe insn pages are not used if ftrace is configured. To see the
> effect of this patch, the kernel must be configured with:
>
> # CONFIG_FUNCTION_TRACER is not set
> CONFIG_KPROBES=y
>
> and for optimised kprobes:
>
> CONFIG_OPTPROBES=y
>
> Example on x86:
>
> # perf probe __schedule
> Added new event:
> probe:__schedule (on __schedule)
> # cat /proc/kallsyms | grep '\[__builtin__kprobes\]'
> ffffffffc00d4000 t kprobe_insn_page [__builtin__kprobes]
> ffffffffc00d6000 t kprobe_optinsn_page [__builtin__kprobes]
>
I'm confused; why are you iterating pages and not slots? A 'page' is not
a symbol, they contain text, sometimes.
If you iterate slots you can even get them a proper name; something
like:
optinsn-sym+xxx [__builtin__kprobes]
insn-sym+xxx [__builtin__kprobes]