diff options
author | Elliott Hughes <enh@google.com> | 2017-11-29 19:34:10 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-11-29 19:34:10 +0000 |
commit | 65ba81b4e86aa4f3b11f5bd653551f52636390f8 (patch) | |
tree | 033dfd2fcb4e061868351173a803ee19f180dc74 /linker/linker.cpp | |
parent | f1e645c67b3d0850c7359c3bc8ee231de11b0a17 (diff) | |
parent | 4eb332439a68e2b2f629e46f1e93d6246bfa53d9 (diff) |
Merge "Revert "Fix bug with double unload on unsuccessful dlopen""
am: 4eb332439a
Change-Id: I21ba611931b2e5794ef49cae9bcafc8748ebe804
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index ac7ad1ca2..1a005faa0 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -321,7 +321,9 @@ static void soinfo_free(soinfo* si) { TRACE("name %s: freeing soinfo @ %p", si->get_realpath(), si); if (!solist_remove_soinfo(si)) { - async_safe_fatal("soinfo=%p is not in soinfo_list (double unload?)", si); + // TODO (dimitry): revisit this - for now preserving the logic + // but it does not look right, abort if soinfo is not in the list instead? + return; } // clear links to/from si @@ -1539,6 +1541,11 @@ bool find_libraries(android_namespace_t* ns, } }); + auto failure_guard = android::base::make_scope_guard([&]() { + // Housekeeping + soinfo_unload(soinfos, soinfos_count); + }); + ZipArchiveCache zip_archive_cache; // Step 1: expand the list of load_tasks to include @@ -1703,6 +1710,8 @@ bool find_libraries(android_namespace_t* ns, si->set_linked(); } }); + + failure_guard.Disable(); } return linked; @@ -1712,7 +1721,7 @@ static soinfo* find_library(android_namespace_t* ns, const char* name, int rtld_flags, const android_dlextinfo* extinfo, soinfo* needed_by) { - soinfo* si = nullptr; + soinfo* si; // readers_map is shared across recursive calls to find_libraries. // However, the map is not shared across different threads. @@ -1731,9 +1740,6 @@ static soinfo* find_library(android_namespace_t* ns, false /* add_as_children */, true /* search_linked_namespaces */, readers_map)) { - if (si != nullptr) { - soinfo_unload(si); - } return nullptr; } |