Title: [200654] trunk/Source/bmalloc
- Revision
- 200654
- Author
- [email protected]
- Date
- 2016-05-10 16:47:10 -0700 (Tue, 10 May 2016)
Log Message
bmalloc should automatically disable itself when ThreadSanitizer is used
<https://webkit.org/b/157527>
Reviewed by Michael Catanzaro.
* bmalloc/Environment.cpp:
(bmalloc::isASanEnabled): Rename to isSanitizerEnabled.
(bmalloc::isSanitizerEnabled): Rename from isASanEnabled. Add
support for detecting ThreadSanitizer.
(bmalloc::Environment::computeIsBmallocEnabled): Switch from
isASanEnabled to isSanitizerEnabled.
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (200653 => 200654)
--- trunk/Source/bmalloc/ChangeLog 2016-05-10 23:45:17 UTC (rev 200653)
+++ trunk/Source/bmalloc/ChangeLog 2016-05-10 23:47:10 UTC (rev 200654)
@@ -1,3 +1,17 @@
+2016-05-10 David Kilzer <[email protected]>
+
+ bmalloc should automatically disable itself when ThreadSanitizer is used
+ <https://webkit.org/b/157527>
+
+ Reviewed by Michael Catanzaro.
+
+ * bmalloc/Environment.cpp:
+ (bmalloc::isASanEnabled): Rename to isSanitizerEnabled.
+ (bmalloc::isSanitizerEnabled): Rename from isASanEnabled. Add
+ support for detecting ThreadSanitizer.
+ (bmalloc::Environment::computeIsBmallocEnabled): Switch from
+ isASanEnabled to isSanitizerEnabled.
+
2016-05-03 Geoffrey Garen <[email protected]>
Assertion failure in bmalloc::vmRevokePermissions(void*, unsigned long).
Modified: trunk/Source/bmalloc/bmalloc/Environment.cpp (200653 => 200654)
--- trunk/Source/bmalloc/bmalloc/Environment.cpp 2016-05-10 23:45:17 UTC (rev 200653)
+++ trunk/Source/bmalloc/bmalloc/Environment.cpp 2016-05-10 23:47:10 UTC (rev 200654)
@@ -75,23 +75,31 @@
return true;
}
-static bool isASanEnabled()
+static bool isSanitizerEnabled()
{
#if BOS(DARWIN)
+ static const char sanitizerPrefix[] = "/libclang_rt.";
+ static const char asanName[] = "asan_";
+ static const char tsanName[] = "tsan_";
uint32_t imageCount = _dyld_image_count();
for (uint32_t i = 0; i < imageCount; ++i) {
const char* imageName = _dyld_get_image_name(i);
if (!imageName)
continue;
- if (strstr(imageName, "/libclang_rt.asan_"))
- return true;
+ if (const char* s = strstr(imageName, sanitizerPrefix)) {
+ const char* sanitizerName = s + sizeof(sanitizerPrefix) - 1;
+ if (!strncmp(sanitizerName, asanName, sizeof(asanName) - 1))
+ return true;
+ if (!strncmp(sanitizerName, tsanName, sizeof(tsanName) - 1))
+ return true;
+ }
}
return false;
#elif BOS(UNIX)
void* handle = dlopen(nullptr, RTLD_NOW);
if (!handle)
return false;
- bool result = !!dlsym(handle, "__asan_poison_memory_region");
+ bool result = !!dlsym(handle, "__asan_init") || !!dlsym(handle, "__tsan_init");
dlclose(handle);
return result;
#else
@@ -110,7 +118,7 @@
return false;
if (isLibgmallocEnabled())
return false;
- if (isASanEnabled())
+ if (isSanitizerEnabled())
return false;
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes