From 91d934ac73ae5a198ae0db4203c8fcf79e4df288 Mon Sep 17 00:00:00 2001 From: "Christopher R. Palmer" Date: Tue, 1 Dec 2015 06:50:22 -0500 Subject: Revert "Revert "linker: Reset the active shim libs each time we do a dlopen"" This reverts commit fd0140b028dedabc572f4659cc015edfeee3cd60. Change-Id: I42b3acfcdc6b84251a396b9e42604bb5685196bd --- linker/linker.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/linker/linker.cpp b/linker/linker.cpp index 2aafc6c05..99807f154 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -896,13 +896,18 @@ static std::vector g_ld_all_shim_libs; static linked_list_t 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; @@ -1745,6 +1750,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(); -- cgit v1.2.3