If you only care about Clang (not sure), bmalloc::isASanEnabled could be as simple as: static bool isASanEnabled() { #if defined(__has_feature) && __has_feature(address_sanitizer) return true; #else return false; #endif } Unless there is some reason I don't understand for the runtime check. GCC supports asan but not __has_feature. This runtime check works: void *handle = dlopen(nullptr, RTLD_NOW); if (!handle) return false; bool result = !!dlsym(handle, "__asan_poison_memory_region"); dlclose(handle); return result; I expect that would work fine on Darwin too.
Created attachment 260254 [details] Patch
Created attachment 260255 [details] Patch
The runtime check is needed because we need to disable bmalloc whenever ASan is enabled in the process - even if bmalloc itself is compiled without ASan.
OK, that makes sense.
Created attachment 260289 [details] Patch
Comment on attachment 260289 [details] Patch r=me
Committed r189181: <http://trac.webkit.org/changeset/189181>