microsoft / microsoft/Detours

`detour_skip_jmp` for arm64 doesn't support unconditional branch

Open
#295 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
6.4k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hello! I found that there is almost the same issue as https://github.com/microsoft/Detours/issues/293 with DetourCodeFromPointer on arm64. It doesn't work properly for OutputDebugStringA, because detour_skip_jmp doesn't support unconditional jump B <label>. As a result, when you try to hook OutputDebugStringA you are actually hooking kernel32.dll!OutputDebugStringAStub instead of the KernelBase.dll!OutputDebugStringA.

https://github.com/microsoft/Detours/blob/734ac64899c44933151c1335f6ef54a590219221/src/detours.cpp#L1049

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/detours.cpp at detour_skip_jmp, around line 1049, and inspect how ARM64 jumps are handled. Reproduce the OutputDebugStringA hooking case and verify that unconditional B branches resolve to KernelBase.dll!OutputDebugStringA rather than the stub; add or run the relevant ARM64 coverage if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.