Skip to content

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

Open
dnivra wants to merge 7 commits into
masterfrom
fix/fix-movable-instrs-computation-in-x86
Open

Fix movable instructions computation in x86-64 detour backend#53
dnivra wants to merge 7 commits into
masterfrom
fix/fix-movable-instrs-computation-in-x86

Conversation

@dnivra

@dnivra dnivra commented Nov 22, 2023

Copy link
Copy Markdown
Contributor

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

dnivra commented Nov 23, 2023

Copy link
Copy Markdown
Contributor Author

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

dnivra commented Nov 23, 2023

Copy link
Copy Markdown
Contributor Author

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