Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_kprobe_functions() omits module functions #1747

Closed
markdrayton opened this issue May 9, 2018 · 1 comment
Closed

get_kprobe_functions() omits module functions #1747

markdrayton opened this issue May 9, 2018 · 1 comment

Comments

@markdrayton
Copy link
Contributor

I noticed funccount and friends were unable to attach to NFS functions on my systems. E.g.:

$ sudo funccount nfs_opendir
No functions matched by pattern ^nfs_opendir$

There are two reasons for this:

  1. Module functions are listed in kallsyms with an additional [module_name] column. The parsing code needs to be updated to handle the extra column (e.g. https://github.com/markdrayton/bcc/commit/9f0ab450e73ae299557ee0abfaeffa912dc57c79)

  2. skip kprobe functions outside normal text section #1647 added excluding of symbols outside of [_stext, _etext]. It seems module functions are outside of this range:

$ sudo egrep '(_[es]text|nfs_opendir)' /proc/kallsyms 
ffffffff81000000 T _stext
ffffffff8196a69e T _etext
ffffffffa01f9df0 t nfs_opendir  [nfs]

I'm not sure how the second issue should be solved. @yonghong-song, any suggestions?

@yonghong-song
Copy link
Collaborator

Thanks for reporting. I think we can just exclude functions in init sections (__init_begin, __init_end). This should catch most of cases.
https://github.com/torvalds/linux/blob/4c3579f6cadd5eb8250a36e789e6df66f660237a/kernel/extable.c#L122

Will submit a patch soon.

yonghong-song added a commit that referenced this issue May 10, 2018
Fix issue #1747.

In commit #1647, we excluded all symbols outside [_stext, _etext].
This is incorrect as it excluded module symbols as well.

This patch changed the algorithm to only skip symbols
in init sections [__init_begin, __init_end].

Signed-off-by: Yonghong Song <[email protected]>
banh-gao pushed a commit to banh-gao/bcc that referenced this issue Jun 21, 2018
Fix issue iovisor#1747.

In commit iovisor#1647, we excluded all symbols outside [_stext, _etext].
This is incorrect as it excluded module symbols as well.

This patch changed the algorithm to only skip symbols
in init sections [__init_begin, __init_end].

Signed-off-by: Yonghong Song <[email protected]>
CrackerCat pushed a commit to CrackerCat/bcc that referenced this issue Jul 31, 2024
Fix issue iovisor#1747.

In commit iovisor#1647, we excluded all symbols outside [_stext, _etext].
This is incorrect as it excluded module symbols as well.

This patch changed the algorithm to only skip symbols
in init sections [__init_begin, __init_end].

Signed-off-by: Yonghong Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants