Skip to content

Follow ARM64 B <label> branches to import thunks#381

Open
RatinCN wants to merge 1 commit into
microsoft:mainfrom
RatinCN:fix/arm64-b-label-import-thunks
Open

Follow ARM64 B <label> branches to import thunks#381
RatinCN wants to merge 1 commit into
microsoft:mainfrom
RatinCN:fix/arm64-b-label-import-thunks

Conversation

@RatinCN
Copy link
Copy Markdown
Contributor

@RatinCN RatinCN commented May 27, 2026

Fixes #295. Already fixed in my SlimDetours in commit 3560905.

Handle ARM64 entrypoints that start with B when the branch target is an import thunk recognized by the normal ADRP/LDR/BR path.

As #295 said, If the #295 fix is merged by itself, the initial B branch will be decoded correctly and Detours can reach the label. However, if the following ADRP uses a negative page delta, it can still be affected by the existing sign-extension bug tracked in #296. Ideally, both fixes (this and #380) should be merged.

Handle ARM64 entrypoints that start with B <label> when the branch target is an import thunk recognized by the normal ADRP/LDR/BR path.

Do not treat every unconditional branch as an alias: keep ordinary B <label> instructions unchanged unless the target resolves to a verified import jump.
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.

detour_skip_jmp for arm64 doesn't support unconditional branch

1 participant