Recognize REX-prefixed indirect JMP thunks#379
Open
RatinCN wants to merge 1 commit into
Open
Conversation
Decode x64 import-style FF /4 indirect JMP thunks with an optional single-byte REX prefix before the opcode, so valid forms such as 48 FF 25 disp32 and other 40..4F FF 25 disp32 encodings are handled consistently. Reuse the shared decoder in detour_skip_jmp, detour_find_jmp_bounds, and detour_does_code_end_function so thunk skipping, trampoline bounds, and function-end detection agree. Leave the x86 path unchanged. Keep the HPAT OS-patch probe unchanged: it still matches the exact unprefixed FF 25 disp32 stub generated by the OS, instead of broadening that special-case path to REX-prefixed forms.
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.
This PR fixes issue #293. I fixed this in my SlimDetours commit 57e0a24, and now create this PR to Detours.
Decode x64 import-style FF /4 indirect JMP thunks with an optional single-byte REX prefix before the opcode, so valid forms such as 48 FF 25 disp32 and other 40..4F FF 25 disp32 encodings are handled consistently.
Reuse the shared decoder in detour_skip_jmp, detour_find_jmp_bounds, and detour_does_code_end_function so thunk skipping, trampoline bounds, and function-end detection agree. Leave the x86 path unchanged.
Keep the HPAT OS-patch probe unchanged: it still matches the exact unprefixed FF 25 disp32 stub generated by the OS, instead of broadening that special-case path to REX-prefixed forms.