Skip to content

shiva_tf_relink_local_branch_x86_64 re-writes short branch with offset that becomes negative in splice patches larger than 127 bytes in length. #21

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

Open
elfmaster opened this issue Feb 23, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@elfmaster
Copy link
Contributor

elfmaster commented Feb 23, 2024

shiva_tf_relink_local_branch_x86_64 re-writes short branch with offset that becomes negative in splice patches larger than 127 bytes in length.

In short... the two byte instruction "\x74\0x00" can only hold a one byte offset. If it goes beyond 127 bytes than it becomes a negative offset and the 'je' instruction jumps to an invalid location.

Shiva needs to calculate which local branches will need to be re-written from a "Short branch" to a "Near branch" and then rewrite

@elfmaster elfmaster added the bug Something isn't working label Feb 23, 2024
@elfmaster elfmaster added this to the x86_64 port milestone Feb 23, 2024
@elfmaster elfmaster self-assigned this Feb 23, 2024
elfmaster added a commit that referenced this issue Feb 26, 2024
…e in shiva_transform.c handle the relinking of 2 byte jump instructions properly. Still need to fix #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant