Skip to content

Commit 5f10ec6

Browse files
committed
[win/asan] GetInstructionSize: Support some more 4 byte instructions.
This patch adds several instructions seen when trying to run a executable built with ASan with llvm-mingw. (x86 and x86_64, using the git tip in llvm-project). Also includes instructions collected by Roman Pišl and Eric Pouech in the Wine bug reports below. Related: #96270 Co-authored-by: Roman Pišl <[email protected]> https://bugs.winehq.org/show_bug.cgi?id=50993 https://bugs.winehq.org/attachment.cgi?id=70233 Co-authored-by: Eric Pouech <[email protected]> https://bugs.winehq.org/show_bug.cgi?id=52386 https://bugs.winehq.org/attachment.cgi?id=71626
1 parent 7fb2652 commit 5f10ec6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,8 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
654654
}
655655

656656
switch (0x00FFFFFF & *(u32 *)address) {
657+
case 0x244C8D: // 8D 4C 24 XX : lea ecx, [esp + XX]
658+
return 4;
657659
case 0x24A48D: // 8D A4 24 XX XX XX XX : lea esp, [esp + XX XX XX XX]
658660
if (rel_offset)
659661
*rel_offset = 3;
@@ -819,6 +821,8 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
819821
case 0x588948: // 48 89 58 XX : mov QWORD PTR[rax + XX], rbx
820822
case 0xec8348: // 48 83 ec XX : sub rsp, XX
821823
case 0xf88349: // 49 83 f8 XX : cmp r8, XX
824+
case 0x148d4e: // 4e 8d 14 XX : lea r10, [rcx+r8*XX]
825+
case 0x398366: // 66 83 39 XX : cmp WORD PTR [rcx], XX
822826
return 4;
823827

824828
case 0x246483: // 83 64 24 XX YY : and DWORD PTR [rsp+XX], YY
@@ -873,7 +877,13 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
873877
}
874878

875879
switch (*(u32*)(address)) {
880+
case 0x01b60f44: // 44 0f b6 01 : movzx r8d, BYTE PTR [rcx]
881+
case 0x09b60f44: // 44 0f b6 09 : movzx r9d, BYTE PTR [rcx]
882+
case 0x0ab60f44: // 44 0f b6 0a : movzx r8d, BYTE PTR [rdx]
883+
case 0x11b60f44: // 44 0f b6 11 : movzx r10d, BYTE PTR [rcx]
876884
case 0x1ab60f44: // 44 0f b6 1a : movzx r11d, BYTE PTR [rdx]
885+
case 0x11048d4c: // 4c 8d 04 11 : lea r8,[rcx+rdx*1]
886+
case 0xff488d49: // 49 8d 48 ff : lea rcx,[r8-0x1]
877887
return 4;
878888
case 0x24448b48: // 48 8b 44 24 XX : mov rax, QWORD ptr [rsp + XX]
879889
case 0x246c8948: // 48 89 6C 24 XX : mov QWORD ptr [rsp + XX], rbp

0 commit comments

Comments
 (0)