From 76eb84a4f4f101a11d6b8553ea71152d1c9ce731 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Mon, 20 Apr 2020 18:01:00 -0700 Subject: [PATCH] __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) --- linker/dlfcn.cpp | 1 + 1 file changed, 1 insertion(+) 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); }