Skip to content

Commit 3cea0e7

Browse files
committed
[win/asan] GetInstructionSize: Support some more 5 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 5f10ec6 commit 3cea0e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
594594

595595
case 0xb8: // b8 XX XX XX XX : mov eax, XX XX XX XX
596596
case 0xB9: // b9 XX XX XX XX : mov ecx, XX XX XX XX
597+
case 0xBA: // ba XX XX XX XX : mov edx, XX XX XX XX
597598
return 5;
598599

599600
// Cannot overwrite control-instruction. Return 0 to indicate failure.
@@ -902,6 +903,12 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
902903
return 6;
903904
}
904905

906+
switch (0xFFFFFFFFFFULL & *(u64*)(address)) {
907+
case 0xC07E0F4866: // 66 48 0F 7E C0 : movq rax,xmm0 (for wine fexp)
908+
case 0x0000441F0F: // 0F 1F 44 00 00 : nop DWORD PTR [rax+rax*1+0x0]
909+
return 5;
910+
}
911+
905912
#else
906913

907914
switch (*(u8*)address) {

0 commit comments

Comments
 (0)