[PATCH] D24699: [asan] Allow re-exec in instrumented unit tests on Darwin (fix unit tests on macOS <=10.10)

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 13:33:55 PST 2016


kubabrecka updated this revision to Diff 78064.
kubabrecka added a comment.

> Sorry, I don't quite understand - do you need to enable re-exec back only for certain OSX versions? If so, shouldn't you check for them?

That's right.  On 10.10 and below, we still need re-exec for unit tests to run correctly.  However, it's very hard to do anything in ReexecDisabled(), because it cannot access memory (because it's instrumented and runs too early) and it can't safely call other methods (they might invoke interceptors or instrumented memory accesses).  Even if we blacklisted this function, checking the version of OS X is far too complex to be done without function calls.  Can we just allow this for all Darwin versions?  On 10.11 and newer, re-exec doesn't happen anyway.


https://reviews.llvm.org/D24699

Files:
  lib/asan/tests/asan_test_main.cc


Index: lib/asan/tests/asan_test_main.cc
===================================================================
--- lib/asan/tests/asan_test_main.cc
+++ lib/asan/tests/asan_test_main.cc
@@ -28,7 +28,13 @@
 
 namespace __sanitizer {
 bool ReexecDisabled() {
+#if __has_feature(address_sanitizer) && SANITIZER_MAC
+  // Allow re-exec in instrumented unit tests on Darwin, as we need it to be
+  // run on 10.10 and below.
+  return false;
+#else
   return true;
+#endif
 }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24699.78064.patch
Type: text/x-patch
Size: 472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/0dfeab25/attachment.bin>


More information about the llvm-commits mailing list