[PATCH] D20884: This patch attempts to primitive support for Win64 asan

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 12:56:34 PDT 2016


rnk added a comment.

This is pretty close


================
Comment at: lib/interception/interception_win.cc:38
@@ -37,3 +37,3 @@
 
 static void WriteJumpInstruction(char *jmp_from, char *to) {
   // jmp XXYYZZWW = E9 WW ZZ YY XX, where XXYYZZWW is an offset from jmp_from
----------------
This will be unused in the win64 build, so you should do:
  #ifndef SANITIZER_WINDOWS64
  static void WriteJumpInstruction(...) { ... }
  #else
  static void WriteIndirectJumpInstruction(...) { ... }
  #endif

Otherwise you'll trigger warnings on Linux.

================
Comment at: lib/interception/interception_win.cc:46
@@ -45,1 +45,3 @@
 
+static void WriteIndirectJumpInstruction(char *jmp_from, uptr *indirect_target) {  // NOLINT
+  // jmp [rip + XXYYZZWW] = FF 25 WW ZZ YY XX, where
----------------
Why NOLINT?

================
Comment at: lib/interception/interception_win.cc:302
@@ -190,1 +301,3 @@
   DWORD old_prot, unused_prot;
+#if SANITIZER_WINDOWS64
+  // TODO(wwchrome): Properly handle access violations when finding a safe
----------------
Can you write this in terms of constants that you've computed conditionally above, like you do for the trampoline?

================
Comment at: lib/interception/interception_win.cc:319
@@ -198,3 +318,3 @@
   // Restore the original permissions.
-  if (!VirtualProtect((void *)old_bytes, head, old_prot, &unused_prot))
+  if (!VirtualProtect((void *) (old_bytes - 8), head + 8, old_prot, &unused_prot)) // NOLINT
     return false;  // not clear if this failure bothers us.
----------------
What is the linter complaining about here? Mash clang-format if it's line length.


http://reviews.llvm.org/D20884





More information about the llvm-commits mailing list