From 91d2c5c1d1157f27e723d8ebee458913c6f0ed43 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Fri, 7 May 2021 22:44:29 +0000 Subject: Revert "Avoid loading external libraries from ARTs internal linker namespace." This reverts commit 582448f29f2f2529202bf868d00ba5d3d3776bb6. Reason for revert: breaks tests Change-Id: I2e0b2a28d4644b314887673d4aef4f1094aea289 --- libnativeloader/library_namespaces.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'libnativeloader/library_namespaces.cpp') 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()); } } -- cgit v1.2.3-59-g8ed1b