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

libbpf-tools/offcputime, futexctn: Fix incorrect DSO information in s… #4902

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

ekyooo
Copy link
Contributor

@ekyooo ekyooo commented Feb 6, 2024

…tacktrace

offcputime may display inaccurate DSO information in the stacktrace. Here's an example of the issue:

It shows the same DSO offset for different addresses, which is incorrect.

  $ ./offcputime -v
    ..
    #14 0x00007f8b912a8c (/usr/lib/libcbe.so_0x22afa8c)
    #15 0x000044000a3ee0 (/usr/lib/libcbe.so_0x22afa8c)
    #16 0x000044001fc56c (/usr/lib/libcbe.so_0x22afa8c)

This is why syms__map_addr_dso simply returns NULL when syms__find_dso also returns NULL. In that case, the values of dso_name and dso_offset are not changed. If the dso_name and dso_offset variables have a garbage value before calling syms__map_addr_dso, those garbage values are maintained after calling syms__map_addr_dso.

This patch fixes the issue by reinitializing dso_name and dso_offset variables before calling syms__map_addr_dso.

FYI, there is another PR(#4862) to fix the issue by changing syms__map_addr_dso API.
This PR is to fix the issue in a simple way as the above PR is pending now.

…tacktrace

offcputime may display inaccurate DSO information in the stacktrace.
Here's an example of the issue:

It shows the same DSO offset for different addresses, which is incorrect.
  $ ./offcputime -v
    ..
    iovisor#14 0x00007f8b912a8c (/usr/lib/libcbe.so_0x22afa8c)
    iovisor#15 0x000044000a3ee0 (/usr/lib/libcbe.so_0x22afa8c)
    iovisor#16 0x000044001fc56c (/usr/lib/libcbe.so_0x22afa8c)

This is why syms__map_addr_dso simply returns NULL when syms__find_dso also
returns NULL. In that case, the values of dso_name and dso_offset are not
changed. If the dso_name and dso_offset variables have a garbage value before
calling syms__map_addr_dso, those garbage values are maintained after calling
syms__map_addr_dso.

This patch fixes the issue by reinitializing dso_name and dso_offset variables
before calling syms__map_addr_dso.
@yonghong-song yonghong-song merged commit a5eb4cb into iovisor:master Feb 6, 2024
12 checks passed
dkruces pushed a commit to dkruces/bcc that referenced this pull request Nov 28, 2024
…tacktrace (iovisor#4902)

offcputime may display inaccurate DSO information in the stacktrace.
Here's an example of the issue:

It shows the same DSO offset for different addresses, which is incorrect.
  $ ./offcputime -v
    ..
    iovisor#14 0x00007f8b912a8c (/usr/lib/libcbe.so_0x22afa8c)
    iovisor#15 0x000044000a3ee0 (/usr/lib/libcbe.so_0x22afa8c)
    iovisor#16 0x000044001fc56c (/usr/lib/libcbe.so_0x22afa8c)

This is why syms__map_addr_dso simply returns NULL when syms__find_dso also
returns NULL. In that case, the values of dso_name and dso_offset are not
changed. If the dso_name and dso_offset variables have a garbage value before
calling syms__map_addr_dso, those garbage values are maintained after calling
syms__map_addr_dso.

This patch fixes the issue by reinitializing dso_name and dso_offset variables
before calling syms__map_addr_dso.

Co-authored-by: Eunseon Lee <[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

Successfully merging this pull request may close these issues.

2 participants