Skip to content

Commit 99612a3

Browse files
authored
[win/asan] GetInstructionSize: Support some more 2 byte instructions. (#120235)
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 ``` CC: @zmodem
1 parent ce8c64f commit 99612a3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,17 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
636636
case 0xFF8B: // 8B FF : mov edi, edi
637637
case 0xEC8B: // 8B EC : mov ebp, esp
638638
case 0xc889: // 89 C8 : mov eax, ecx
639+
case 0xD189: // 89 D1 : mov ecx, edx
639640
case 0xE589: // 89 E5 : mov ebp, esp
640641
case 0xC18B: // 8B C1 : mov eax, ecx
642+
case 0xC031: // 31 C0 : xor eax, eax
643+
case 0xC931: // 31 C9 : xor ecx, ecx
644+
case 0xD231: // 31 D2 : xor edx, edx
641645
case 0xC033: // 33 C0 : xor eax, eax
642646
case 0xC933: // 33 C9 : xor ecx, ecx
643647
case 0xD233: // 33 D2 : xor edx, edx
644648
case 0xDB84: // 84 DB : test bl,bl
649+
case 0xC084: // 84 C0 : test al,al
645650
case 0xC984: // 84 C9 : test cl,cl
646651
case 0xD284: // 84 D2 : test dl,dl
647652
return 2;

compiler-rt/lib/interception/tests/interception_win_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,14 +839,19 @@ const struct InstructionSizeData {
839839
{ 1, {0x90}, 0, "90 : nop"},
840840
{ 1, {0xC3}, 0, "C3 : ret (for small/empty function interception"},
841841
{ 1, {0xCC}, 0, "CC : int 3 i.e. registering weak functions)"},
842+
{ 2, {0x31, 0xC0}, 0, "31 C0 : xor eax, eax"},
843+
{ 2, {0x31, 0xC9}, 0, "31 C9 : xor ecx, ecx"},
844+
{ 2, {0x31, 0xD2}, 0, "31 D2 : xor edx, edx"},
842845
{ 2, {0x33, 0xC0}, 0, "33 C0 : xor eax, eax"},
843846
{ 2, {0x33, 0xC9}, 0, "33 C9 : xor ecx, ecx"},
844847
{ 2, {0x33, 0xD2}, 0, "33 D2 : xor edx, edx"},
845848
{ 2, {0x6A, 0x71}, 0, "6A XX : push XX"},
849+
{ 2, {0x84, 0xC0}, 0, "84 C0 : test al,al"},
846850
{ 2, {0x84, 0xC9}, 0, "84 C9 : test cl,cl"},
847851
{ 2, {0x84, 0xD2}, 0, "84 D2 : test dl,dl"},
848852
{ 2, {0x84, 0xDB}, 0, "84 DB : test bl,bl"},
849853
{ 2, {0x89, 0xc8}, 0, "89 C8 : mov eax, ecx"},
854+
{ 2, {0x89, 0xD1}, 0, "89 D1 : mov ecx, edx"},
850855
{ 2, {0x89, 0xE5}, 0, "89 E5 : mov ebp, esp"},
851856
{ 2, {0x8A, 0x01}, 0, "8A 01 : mov al, byte ptr [ecx]"},
852857
{ 2, {0x8B, 0xC1}, 0, "8B C1 : mov eax, ecx"},

0 commit comments

Comments
 (0)