bcc/syms: Fix shared lib module offset <-> global addr conversion #4089
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bcc
does various conversions of "global address" to "module offset" andvice versa. Previous work (#1670) modified the "global address" ->
"module offset" calculation in
ProcSyms::Module::contains
to accountfor 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]