Fix symbol resolution for rust binaries#321
Merged
Xyene merged 1 commit intojanestreet:masterfrom Apr 12, 2025
Merged
Conversation
|
Thanks for your work on this! Now that owee v0.8 is out, perhaps this PR is ready for review @JosiahWhite? |
0343b31 to
28cd489
Compare
Member
|
Could you please rebase on top of the latest master? Don't expect there'll be merge conflicts, but the GitHub build workflow bitrotted. |
Signed-off-by: Josiah White <me@josiahwhite.io>
28cd489 to
b5e7a39
Compare
Contributor
Author
|
Should be all set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently symbol resolution on rust binaries returns an address that is 0x1000 above the correct symbol leading to triggers not working.
The current logic seems to assume the symbol value is an offset from the start of the file, but the spec actually states for an executable that this value is a virtual address already: "In executable and shared object files, st_value holds a virtual address."
Most cases can be solved by just picking the first address from the maps file and adding the symbol value to it but there is an edge case where an exotic binary could select a base virtual address that doesn't start at 0x0. This can be detected by reading the program headers and looking at
p_vaddrfor the firstLOADsegment and subtracting it from the first mapping address that is pulled from /proc/pid/maps.This PR is blocked by let-def/owee#35 being merged and released.