summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher R. Palmer <crpalmer@gmail.com>2015-11-29 08:28:10 -0500
committerChristopher R. Palmer <crpalmer@gmail.com>2015-11-29 08:28:10 -0500
commitad21814c21f40f0e0a4f62e03619e274de9f6983 (patch)
tree6d4fc702974700822bdffec65d3ea43f06314a51
parentf3d29eef755b141a5b51c45d177d69d823290b4b (diff)
downloadbionic-ad21814c21f40f0e0a4f62e03619e274de9f6983.zip
bionic-ad21814c21f40f0e0a4f62e03619e274de9f6983.tar.gz
bionic-ad21814c21f40f0e0a4f62e03619e274de9f6983.tar.bz2
linker: Reset the active shim libs each time we do a dlopen
We use the active libs to avoid recursively trying to load the same library: A -> shimlibs add B -> depends on A -> shimlibs add B -> ... However, when we repeatedly dlopen the same library we need to reset the active shim libs to avoid failing to add B the second time we dlopen A. Change-Id: I27580e3d6a53858e8bca025d6c85f981cffbea06
-rw-r--r--linker/linker.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index daaa502..03d3317 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -896,13 +896,18 @@ static std::vector<std::string> g_ld_all_shim_libs;
static linked_list_t<const std::string> g_active_shim_libs;
-static void parse_LD_SHIM_LIBS(const char* path) {
- parse_path(path, " :", &g_ld_all_shim_libs);
+static void reset_g_active_shim_libs(void) {
+ g_active_shim_libs.clear();
for (const auto& pair : g_ld_all_shim_libs) {
g_active_shim_libs.push_back(&pair);
}
}
+static void parse_LD_SHIM_LIBS(const char* path) {
+ parse_path(path, " :", &g_ld_all_shim_libs);
+ reset_g_active_shim_libs();
+}
+
static bool shim_lib_matches(const char *shim_lib, const char *realpath) {
const char *sep = strchr(shim_lib, '|');
return sep != nullptr && strncmp(realpath, shim_lib, sep - shim_lib) == 0;
@@ -1744,6 +1749,7 @@ soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo)
}
ProtectedDataGuard guard;
+ reset_g_active_shim_libs();
soinfo* si = find_library(name, flags, extinfo);
if (si != nullptr) {
si->call_constructors();