Title: [189181] trunk/Source/bmalloc
Revision
189181
Author
mcatanz...@igalia.com
Date
2015-08-31 13:41:19 -0700 (Mon, 31 Aug 2015)

Log Message

Implement bmalloc::isASanEnabled for generic Unix
https://bugs.webkit.org/show_bug.cgi?id=148623

Reviewed by Geoffrey Garen.

* bmalloc/BPlatform.h: Add BOS_UNIX to detect whether the OS is a Unix.
* bmalloc/Environment.cpp:
(bmalloc::isASanEnabled): Implement a runtime check that should work on any Unix.

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (189180 => 189181)


--- trunk/Source/bmalloc/ChangeLog	2015-08-31 20:32:29 UTC (rev 189180)
+++ trunk/Source/bmalloc/ChangeLog	2015-08-31 20:41:19 UTC (rev 189181)
@@ -1,3 +1,14 @@
+2015-08-31  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        Implement bmalloc::isASanEnabled for generic Unix
+        https://bugs.webkit.org/show_bug.cgi?id=148623
+
+        Reviewed by Geoffrey Garen.
+
+        * bmalloc/BPlatform.h: Add BOS_UNIX to detect whether the OS is a Unix.
+        * bmalloc/Environment.cpp:
+        (bmalloc::isASanEnabled): Implement a runtime check that should work on any Unix.
+
 2015-08-19  Geoffrey Garen  <gga...@apple.com>
 
         Crash @ bmalloc::Environment::computeIsBmallocEnabled

Modified: trunk/Source/bmalloc/bmalloc/BPlatform.h (189180 => 189181)


--- trunk/Source/bmalloc/bmalloc/BPlatform.h	2015-08-31 20:32:29 UTC (rev 189180)
+++ trunk/Source/bmalloc/bmalloc/BPlatform.h	2015-08-31 20:41:19 UTC (rev 189181)
@@ -43,4 +43,8 @@
 #define BOS_DARWIN 1
 #endif
 
+#ifdef __unix
+#define BOS_UNIX 1
+#endif
+
 #endif // BPlatform_h

Modified: trunk/Source/bmalloc/bmalloc/Environment.cpp (189180 => 189181)


--- trunk/Source/bmalloc/bmalloc/Environment.cpp	2015-08-31 20:32:29 UTC (rev 189180)
+++ trunk/Source/bmalloc/bmalloc/Environment.cpp	2015-08-31 20:41:19 UTC (rev 189181)
@@ -29,6 +29,8 @@
 #include <cstring>
 #if BOS(DARWIN)
 #include <mach-o/dyld.h>
+#elif BOS(UNIX)
+#include <dlfcn.h>
 #endif
 
 namespace bmalloc {
@@ -85,6 +87,13 @@
             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");
+    dlclose(handle);
+    return result;
 #else
     return false;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to