handle consecutive PC-relative instructions#238
Open
segfault-bilibili wants to merge 4 commits into
Open
Conversation
b26ac41 to
4dc03d8
Compare
4dc03d8 to
f574bc1
Compare
f574bc1 to
8efbe33
Compare
Author
|
I've updated my description of this problem to just re-clarify it. |
Closed
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.
Disclaimer: I'm not very familiar with C++ or
armeabi-v7aarchitecture.However we encountered a problem using Dobby.
We hooked a function which originally does just one simple thing: read a int32 value from hard-coded vmaddr and return it. We changed the return value in the hook to meet our demand.
However this hook turned out to fail to work correctly on
armeabi-v7aarchitecture.After some investigation, I realized that it's Dobby which cannot handle this situation correctly yet. Therefore I made a patch to deal with this problem.
Example1:
Example2:
The highlighted instruction adds the value of
pcandvmaddr_offset_relative_to_pc. When not relocated, this worked fine. The added-up sum value is meant to be a pointer which points to a "hard-coded" memory address which stores a "globally used" variable.However, after being relocated,
pchas now changed. Nowpcno longer points to the value it was originally meant to be. Therefore the added-up sum value now effectively becomes a wild pointer which points to some random place, which might lead to process crash or other malfunction.This patch changes the highlighted instruction to make it add the original un-relocated
pcinstead of the current relocatedpc, so that the added-up sum value is recovered to point to the originally supposed position. Thus, the problem is fixed, only in this situation which I encountered - I think it's obvious that there are other situations, but fixing them is beyond my capabilities.