Allow dlopening public libs using absolute path
dlopen on isolated namespaces should be able to open
public libraries using absolute path not only soname.
Bug: http://b/25853820
Change-Id: If574a67853dc51226f0f376e9e2d108316002f84
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 9780231..3b1e1d4 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1582,9 +1582,6 @@
}
}
- if (fd != -1 && !ns->is_accessible(*realpath)) {
- fd = -1;
- }
return fd;
}
@@ -1701,6 +1698,13 @@
return false;
}
+ if (!ns->is_accessible(realpath)) {
+ // do not load libraries if they are not accessible for the specified namespace.
+ DL_ERR("library \"%s\" is not accessible for the namespace \"%s\"",
+ name, ns->get_name());
+ return false;
+ }
+
soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags);
if (si == nullptr) {
return false;