[PATCH] D51788: [winasan] Reduce hotpatch prefix check to 8 bytes

David Major via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 7 07:14:23 PDT 2018


dmajor created this revision.
dmajor added a reviewer: rnk.
Herald added subscribers: Sanitizers, llvm-commits.

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


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D51788

Files:
  lib/interception/interception_win.cc


Index: lib/interception/interception_win.cc
===================================================================
--- lib/interception/interception_win.cc
+++ lib/interception/interception_win.cc
@@ -223,8 +223,8 @@
   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 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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51788.164416.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/2c9649c4/attachment.bin>


More information about the llvm-commits mailing list