Skip to content

Commit 5a48a82

Browse files
farzonlplotfi
authored andcommitted
[compiler-rt] Fix interception_win.cpp arm64 instruction lengths
Updates GetInstructionSize to account for arm64 instruction sizes. ARM64 instruction are always 4 bytes long but GetInstructionSize in interception_win.cpp assumes x86_64 which has mixed sizes. Fix is for: #64319 Before the changeclang_rt.asan_dynamic-aarch64.dll would crash at: OverrideFunction -> OverrideFunctionWithHotPatch -> GetInstructionSize:825 After the change: dllthunkintercept -> dllthunkgetrealaddressordie -> InternalGetProcAddress
1 parent c730e3c commit 5a48a82

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,11 @@ static const u8 kPrologueWithShortJump2[] = {
457457

458458
// Returns 0 on error.
459459
static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
460+
#if SANITIZER_ARM64
461+
// An ARM64 instruction is 4 bytes long.
462+
return 4;
463+
#endif
464+
460465
#if SANITIZER_WINDOWS64
461466
if (memcmp((u8*)address, kPrologueWithShortJump1,
462467
sizeof(kPrologueWithShortJump1)) == 0 ||

0 commit comments

Comments
 (0)