__loader_cfi_fail: acquire g_dl_mutex
CfiFail calls find_containing_library, which searches the linker's
internal soinfo list, which could be modified by another thread.
Bug: http://b/150372650
Test: bionic-unit-tests
Change-Id: I59024a0a47913caa75702f15ec058b0a360727b5
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 255363f..ec6850a 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -284,6 +284,7 @@
}
void __loader_cfi_fail(uint64_t CallSiteTypeId, void* Ptr, void *DiagData, void *CallerPc) {
+ ScopedPthreadMutexLocker locker(&g_dl_mutex);
CFIShadowWriter::CfiFail(CallSiteTypeId, Ptr, DiagData, CallerPc);
}