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

Fix movable instructions computation in x86-64 detour backend #53

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dnivra
Copy link
Contributor

@dnivra dnivra commented Nov 22, 2023

This PR fixes the movable instructions computation in the x86-64 detour backend (and thus potentially fix #47). Currently, only the last instruction in the block is check if movable or not. As a result, any unmovable instructions in the middle of the block (eg: instructions with RIP relative addressing) will be treated as movable and trigger a fault if moved. This PR fixes the movable instructions computation to exclude such instructions. Technically, RIP relative instructions can be moved - the argument needs to be modified to ensure the reference is still valid. However, I felt excluding them is easier to implement and so went down that route. If we want to treat RIP relative instructions as movable, I can look into doing that.

@dnivra dnivra marked this pull request as draft November 23, 2023 00:29
@dnivra dnivra marked this pull request as ready for review November 23, 2023 20:33
@dnivra
Copy link
Contributor Author

dnivra commented Nov 23, 2023

I fixed the x86-64 test cases that failed because of changes in this PR. The sole failing test case fails on master as well and so I think this PR can be merged in.

@dnivra
Copy link
Contributor Author

dnivra commented Nov 23, 2023

I fixed the failing test case as well. It seems the test case was incorrectly updated in 29c1c57a and so was failing. Since the change is pretty trivial, I included it in this PR too.

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.

Patched Binary Segfault - DetourBackend
1 participant