summaryrefslogtreecommitdiff
path: root/linker/linker_namespaces.cpp
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2017-02-03 14:07:34 -0800
committerDimitry Ivanov <dimitry@google.com>2017-02-09 23:26:44 -0800
commit7a34b9d57a762ca7cd6b8d6b9f9fb45c2b991da7 (patch)
tree8dad357eee8d7672069abd75a63717d65b5f8ae6 /linker/linker_namespaces.cpp
parent7d429d3c480166e1013bcdf68f4be479209aa509 (diff)
Replace public library list with shared lib sonames (part 2/2)
This commit updates interface of libdl.c. 1. android_init_namespaces is replaces with android_init_anonymous_namespace 2. added 2 arguments to android_create_namespace to specify linked namespace and the list of shared libraries sonames. 3. symbol lookup does not get past boundary libraries (added check and test for it). Bug: http://b/26833548 Bug: http://b/21879602 Test: bionic-unit-tests --gtest_filter=dl*:Dl* Change-Id: I32921da487a02e5bd0d2fc528904d1228394bfb9
Diffstat (limited to 'linker/linker_namespaces.cpp')
-rw-r--r--linker/linker_namespaces.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/linker/linker_namespaces.cpp b/linker/linker_namespaces.cpp
index 675f3243b..a7e14cc50 100644
--- a/linker/linker_namespaces.cpp
+++ b/linker/linker_namespaces.cpp
@@ -27,6 +27,7 @@
*/
#include "linker_namespaces.h"
+#include "linker_soinfo.h"
#include "linker_utils.h"
#include <vector>
@@ -57,3 +58,23 @@ bool android_namespace_t::is_accessible(const std::string& file) {
return false;
}
+bool android_namespace_t::is_accessible(soinfo* s) {
+ std::vector<soinfo*> soinfos;
+ soinfos.push_back(s);
+ s->get_parents().for_each([&](soinfo* parent_si) {
+ soinfos.push_back(parent_si);
+ });
+
+ return std::find_if(soinfos.begin(), soinfos.end(), [this](soinfo* si) {
+ if (si->get_primary_namespace() == this) {
+ return true;
+ }
+
+ const android_namespace_list_t& secondary_namespaces = si->get_secondary_namespaces();
+ if (secondary_namespaces.find(this) != secondary_namespaces.end()) {
+ return true;
+ }
+
+ return false;
+ }) != soinfos.end();
+}