(2013/04/05 11:39), Namhyung Kim wrote:
> From: Namhyung Kim <[email protected]>
> 
> Some of kernel functions are not allowed to be used by kprobes for
> some reason, so they're marked as __kprobe on the source code and
> reside on ".kprobes.text" section.
> 
> However normal users which only see /proc/kallsyms don't know about
> them and would get only general error message when tried to add a
> probe on such function.

Right,

> 
>   $ sudo ./perf probe do_page_fault
>   Failed to find path of kernel module.
>   Added new event:
>   Failed to write event: Invalid argument
>     Error: Failed to add events. (-1)
> 
> This patch enhance it by checking the special kprobes section address
> and if to-be-probed function address is in the section, it would print
> like this:
> 
>   $ sudo ./perf probe do_page_fault
>   Failed to find path of kernel module.
>   Added new event:
>   Failed to write event: kprobes is not allowed for this function.
>     Error: Failed to add events. (-1)

Yeah, I agree that it is hard to know for perf probe users.
However, your implementation strongly depends on the current kernel,
I think we'd better export __kprobe_text_* as macros of symbol strings
in kprobes.h, and reuse it.
Or, export such no-probe symbols via /sys/kernel/debug/kprobes/noprobe_syms

Thank you,


-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to