diff options
author | Calin Juravle <calin@google.com> | 2021-05-07 22:44:29 +0000 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2021-05-09 00:37:05 +0000 |
commit | 91d2c5c1d1157f27e723d8ebee458913c6f0ed43 (patch) | |
tree | 61089b69928171706cf93d939bb068d115e92c5d /libnativeloader/library_namespaces.cpp | |
parent | 6958df93f8cb3d82bddadbabb5ed94b3b63a7f14 (diff) |
Revert "Avoid loading external libraries from ARTs internal linker namespace."
This reverts commit 582448f29f2f2529202bf868d00ba5d3d3776bb6.
Reason for revert: breaks tests
Change-Id: I2e0b2a28d4644b314887673d4aef4f1094aea289
Diffstat (limited to 'libnativeloader/library_namespaces.cpp')
-rw-r--r-- | libnativeloader/library_namespaces.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp index 59369eee43..79fee060cf 100644 --- a/libnativeloader/library_namespaces.cpp +++ b/libnativeloader/library_namespaces.cpp @@ -122,18 +122,16 @@ void LibraryNamespaces::Initialize() { return; } - // Load the preloadable public libraries. Since libnativeloader is in the - // com_android_art namespace, use OpenSystemLibrary rather than dlopen to - // ensure the libraries are loaded in the system namespace. + // android_init_namespaces() expects all the public libraries + // to be loaded so that they can be found by soname alone. // // TODO(dimitry): this is a bit misleading since we do not know // if the vendor public library is going to be opened from /vendor/lib // we might as well end up loading them from /system/lib or /product/lib // For now we rely on CTS test to catch things like this but // it should probably be addressed in the future. - for (const std::string& soname : android::base::Split(preloadable_public_libraries(), ":")) { - void* handle = OpenSystemLibrary(soname.c_str(), RTLD_NOW | RTLD_NODELETE); - LOG_ALWAYS_FATAL_IF(handle == nullptr, + for (const auto& soname : android::base::Split(preloadable_public_libraries(), ":")) { + LOG_ALWAYS_FATAL_IF(dlopen(soname.c_str(), RTLD_NOW | RTLD_NODELETE) == nullptr, "Error preloading public library %s: %s", soname.c_str(), dlerror()); } } |