aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2020-04-20 18:01:00 -0700
committerRyan Prichard <rprichard@google.com>2020-04-22 16:48:36 -0700
commit76eb84a4f4f101a11d6b8553ea71152d1c9ce731 (patch)
tree362e313ae4c261941574fdeabde091a1a31905f5
parent771da6f500352168a1bc1898495261652415b08e (diff)
downloadbionic-76eb84a4f4f101a11d6b8553ea71152d1c9ce731.tar.gz
__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 (cherry picked from commit 172611f5cee5ce1351a83ec9f83e13235d04b008)
-rw-r--r--linker/dlfcn.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 255363f96..ec6850a40 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -284,6 +284,7 @@ android_namespace_t* __loader_android_get_exported_namespace(const char* name) {
}
void __loader_cfi_fail(uint64_t CallSiteTypeId, void* Ptr, void *DiagData, void *CallerPc) {
+ ScopedPthreadMutexLocker locker(&g_dl_mutex);
CFIShadowWriter::CfiFail(CallSiteTypeId, Ptr, DiagData, CallerPc);
}