[compiler-rt] r342649 - [winasan] Reduce hotpatch prefix check to 8 bytes

David Major via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 20 07:28:50 PDT 2018


Author: dmajor
Date: Thu Sep 20 07:28:50 2018
New Revision: 342649

URL: http://llvm.org/viewvc/llvm-project?rev=342649&view=rev
Log:
[winasan] Reduce hotpatch prefix check to 8 bytes

Same idea as r310419: The 8 byte nop is a suffix of the 9 byte nop, and we need at most 6 bytes.

Differential Revision: https://reviews.llvm.org/D51788


Modified:
    compiler-rt/trunk/lib/interception/interception_win.cc

Modified: compiler-rt/trunk/lib/interception/interception_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception_win.cc?rev=342649&r1=342648&r2=342649&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception_win.cc (original)
+++ compiler-rt/trunk/lib/interception/interception_win.cc Thu Sep 20 07:28:50 2018
@@ -223,8 +223,8 @@ static bool IsMemoryPadding(uptr address
   return true;
 }
 
-static const u8 kHintNop9Bytes[] = {
-  0x66, 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
+static const u8 kHintNop8Bytes[] = {
+  0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
 template<class T>
@@ -239,8 +239,8 @@ static bool FunctionHasPrefix(uptr addre
 static bool FunctionHasPadding(uptr address, uptr size) {
   if (IsMemoryPadding(address - size, size))
     return true;
-  if (size <= sizeof(kHintNop9Bytes) &&
-      FunctionHasPrefix(address, kHintNop9Bytes))
+  if (size <= sizeof(kHintNop8Bytes) &&
+      FunctionHasPrefix(address, kHintNop8Bytes))
     return true;
   return false;
 }




More information about the llvm-commits mailing list