summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-11-29 18:47:42 +0000
committerElliott Hughes <enh@google.com>2017-11-29 18:48:33 +0000
commit27f1806b90aefa8b1335d0fdc3f109a8ac258638 (patch)
tree8490a196e61d2d161daa349898ff9a2cbcffb3d7 /linker/linker.cpp
parent58554ccb8ac27fd3b5693efde2e1f7ab2a895ea2 (diff)
Revert "Fix bug with double unload on unsuccessful dlopen"
This reverts commit 58554ccb8ac27fd3b5693efde2e1f7ab2a895ea2. causes /vendor/bin/qseecomd to hit the new abort: [ 8.983301] c5 603 DEBUG: Abort message: 'soinfo=0x7147894cd0 is not in soinfo_list (double unload?)' Bug: http://b/69909887 Bug: http://b/69787209 Change-Id: Ied38f797e0a071a1acc5ed41adf1b45e855143c7
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index f1ef55788..85376e0f7 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
@@ -1518,6 +1520,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
@@ -1682,6 +1689,8 @@ bool find_libraries(android_namespace_t* ns,
si->set_linked();
}
});
+
+ failure_guard.Disable();
}
return linked;
@@ -1691,7 +1700,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.
@@ -1710,9 +1719,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;
}