summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/malloc_debug.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-05-22 13:39:57 -0700
committerChristopher Ferris <cferris@google.com>2019-05-22 17:16:37 -0700
commit705de3c6398d53b780d731008bafc3c2dafbbf85 (patch)
tree1118ec9cf1ce812c4d02d482a3b0f1a311036e32 /libc/malloc_debug/malloc_debug.cpp
parentd277334059f5c0c08ea312cad84f003c0d9f3519 (diff)
Disable malloc debug when asan enabled.
Bug: 123312263 Test: Verified with asan enabled, malloc debug does not initialize. Test: Ran tests on non-asan build and verify they pass. Change-Id: I3c37c170bf6c1de42740972f2113ae991351d931
Diffstat (limited to 'libc/malloc_debug/malloc_debug.cpp')
-rw-r--r--libc/malloc_debug/malloc_debug.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index 53fcead01..c030d5429 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -252,12 +252,19 @@ static void* InitHeader(Header* header, void* orig_pointer, size_t size) {
return g_debug->GetPointer(header);
}
+extern "C" void __asan_init() __attribute__((weak));
+
bool debug_initialize(const MallocDispatch* malloc_dispatch, bool* zygote_child,
const char* options) {
if (zygote_child == nullptr || options == nullptr) {
return false;
}
+ if (__asan_init != 0) {
+ error_log("malloc debug cannot be enabled alongside ASAN");
+ return false;
+ }
+
InitAtfork();
g_zygote_child = zygote_child;