RESOLVED FIXED 148623
Implement bmalloc::isASanEnabled for generic Unix
https://bugs.webkit.org/show_bug.cgi?id=148623
Summary Implement bmalloc::isASanEnabled for generic Unix
Michael Catanzaro
Reported 2015-08-30 16:30:09 PDT
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.
Attachments
Patch (2.35 KB, patch)
2015-08-30 16:34 PDT, Michael Catanzaro
no flags
Patch (2.39 KB, patch)
2015-08-30 16:43 PDT, Michael Catanzaro
no flags
Patch (1.92 KB, patch)
2015-08-31 09:31 PDT, Michael Catanzaro
ggaren: review+
Michael Catanzaro
Comment 1 2015-08-30 16:34:34 PDT
Michael Catanzaro
Comment 2 2015-08-30 16:43:54 PDT
Alexey Proskuryakov
Comment 3 2015-08-30 17:43:05 PDT
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.
Michael Catanzaro
Comment 4 2015-08-31 09:28:56 PDT
OK, that makes sense.
Michael Catanzaro
Comment 5 2015-08-31 09:31:30 PDT
Geoffrey Garen
Comment 6 2015-08-31 13:16:47 PDT
Comment on attachment 260289 [details] Patch r=me
Michael Catanzaro
Comment 7 2015-08-31 13:41:41 PDT
Note You need to log in before you can comment on or make changes to this bug.