skip kprobe functions outside normal text section
Fix issue #1634.
When kernel is about to attach a kprobe, the following functions
are called:
register_kprobe
check_kprobe_address_safe
kernel_text_address
core_kernel_text
In core_kernel_text, we have:
if (addr >= (unsigned long)_stext &&
addr < (unsigned long)_etext)
return 1;
Basically, any address outside of [_stext, _etext] will
be rejected.
The functions marked as __init are outside [_stext, _etext].
That is why vfs_caches_init_early and vfs_caches_init
are rejected by trace_kprobe.
Given a regex, this patch avoided attaching these functions
if their func addresses are outside [_stext, _etext] range.
Signed-off-by: Yonghong Song <yhs@fb.com>
Showing
Please register or sign in to comment