Workaround ASan not knowing about reallocarray.
Ensure we call realloc@plt rather than (as was previously happening)
inlining realloc into reallocarray, which makes the allocation invisible
to ASan.
Bug: http://b/129989984
Test: objdump
(cherry picked from commit 390be50067c03524b420cae83fd97992f26fa754)
Change-Id: I0676b70cb9a7d7323252eabfff055c0e806915ef
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
index 60ee138..9dc4d12 100644
--- a/libc/bionic/malloc_common.cpp
+++ b/libc/bionic/malloc_common.cpp
@@ -155,7 +155,7 @@
return result;
}
-extern "C" void* realloc(void* old_mem, size_t bytes) {
+extern "C" __attribute__((__noinline__)) void* realloc(void* old_mem, size_t bytes) {
auto dispatch_table = GetDispatchTable();
if (__predict_false(dispatch_table != nullptr)) {
return dispatch_table->realloc(old_mem, bytes);