[PATCH] D22274: [asan] Fix interception unittest on Windows64.

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 12:46:26 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL275207: [asan] Fix interception unittest on Windows64. (authored by etienneb).

Changed prior to commit:
  http://reviews.llvm.org/D22274?vs=63710&id=63717#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D22274

Files:
  compiler-rt/trunk/lib/interception/interception_win.cc
  compiler-rt/trunk/lib/interception/tests/interception_win_test.cc

Index: compiler-rt/trunk/lib/interception/interception_win.cc
===================================================================
--- compiler-rt/trunk/lib/interception/interception_win.cc
+++ compiler-rt/trunk/lib/interception/interception_win.cc
@@ -461,6 +461,7 @@
     case 0x5541:  // push r13
     case 0x5641:  // push r14
     case 0x5741:  // push r15
+    case 0x9066:  // Two-byte NOP
       return 2;
   }
 
Index: compiler-rt/trunk/lib/interception/tests/interception_win_test.cc
===================================================================
--- compiler-rt/trunk/lib/interception/tests/interception_win_test.cc
+++ compiler-rt/trunk/lib/interception/tests/interception_win_test.cc
@@ -234,8 +234,18 @@
 
   // Add the detour instruction (i.e. mov edi, edi)
   if (prefix_kind == FunctionPrefixDetour) {
+#if SANITIZER_WINDOWS64
+    // Note that "mov edi,edi" is NOP in 32-bit only, in 64-bit it clears
+    // higher bits of RDI.
+    // Use 66,90H as NOP for Windows64.
+    ActiveCode[position++] = 0x66;
+    ActiveCode[position++] = 0x90;
+#else
+    // mov edi,edi.
     ActiveCode[position++] = 0x8B;
     ActiveCode[position++] = 0xFF;
+#endif
+
   }
 
   // Copy the function body.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22274.63717.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160712/84701481/attachment.bin>


More information about the llvm-commits mailing list