You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sewer56
changed the title
Incorrect Behaviour: Arm64 CopyLdrLiteral rewrites Prefetch as Memory Read
Incorrect Behaviour: Arm64 CopyLdrLiteral rewrites Prefetch as Memory Read, which can Trash a Potentially Used Register
Nov 2, 2023
Describe the bug
This is a sister bug to:
In the following detours code
Detours/src/disasm.cpp
Lines 4226 to 4261 in 4b8c659
which rewrites LDR Literal, the PRFM (Prefetch) instruction is rewritten as a load.
This happens because LDR literal and PRFM use the same opcode, and thus the LDR code path would be used for PRFM
Detours/src/disasm.cpp
Lines 3967 to 3969 in 4b8c659
e.g.
PRFM PLIL1KEEP, #0
is0xD8000008
.(0xD8000008 & 0x3b000000)
==0x18000000
is true, thus the LDR code path is executed for PRFM.Expected behavior
Prefetch operation should not be rewritten as a load, as this will trash the existing value in the register, which may still be used by the function.
Additional context
I'm building a cross platform, multi architecture hooking library [big WIP]; and I found detours' source to be pretty invaluable as a reference for code rewriting.
This is just a small thing I noticed while working on code rewriting on my end while referencing detours.
The text was updated successfully, but these errors were encountered: