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

bcc/syms: Fix shared lib module offset <-> global addr conversion #4089

Merged

Conversation

davemarchevsky
Copy link
Collaborator

bcc does various conversions of "global address" to "module offset" and
vice versa. Previous work (#1670) modified the "global address" ->
"module offset" calculation in ProcSyms::Module::contains to account
for differences between the file offset a section is loading bytes from
and the requested start address (relative to the base address of the
.so). Unfortunately that change didn't also modify "module offset" ->
"global address" calculations, such as the one in
bcc_resolve_global_addr. Update that calculation to account for the
same.

This calculation discrepancy was most apparent for us in production when
trying to attach USDTs to a shared lib with differing requested start
address and file offset. This patch also adds a test w/ comments
describing our specific situation and demonstrating how the patch fixes
the issue.

Signed-off-by: Dave Marchevsky [email protected]

`bcc` does various conversions of "global address" to "module offset" and
vice versa. Previous work (iovisor#1670) modified the "global address" ->
"module offset" calculation in `ProcSyms::Module::contains` to account
for differences between the file offset a section is loading bytes from
and the requested start address (relative to the base address of the
`.so`). Unfortunately that change didn't also modify "module offset" ->
"global address" calculations, such as the one in
bcc_resolve_global_addr. Update that calculation to account for the
same.

This calculation discrepancy was most apparent for us in production when
trying to attach USDTs to a shared lib with differing requested start
address and file offset. This patch also adds a test w/ comments
describing our specific situation and demonstrating how the patch fixes
the issue.

Signed-off-by: Dave Marchevsky <[email protected]>
@davemarchevsky davemarchevsky merged commit c54336e into iovisor:master Jul 5, 2022
fengjixuchui added a commit to fengjixuchui/bcc that referenced this pull request Jul 5, 2022
Merge pull request iovisor#4089 from davemarchevsky/davemarchevsky_fi…
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.

None yet

1 participant