summaryrefslogtreecommitdiff
path: root/linker/linker_namespaces.cpp
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2019-01-12 21:03:25 -0800
committerVic Yang <victoryang@google.com>2019-03-20 10:20:49 -0700
commit2d020e43fb098dde99d6f9a1c5f4aeebdda914ea (patch)
tree8e53ae0dc313d988ad66ea5892f4daf9e5349b08 /linker/linker_namespaces.cpp
parentebdf4c19f9e034d7ec8e0e57539890d5c93eaed1 (diff)
linker: Add support for "whitelisted" property in linker config files
In order to enable no-vendor-variant VNDK, we need a way to restrict a namespace to only a list of whitelisted libraries. We add a new "whitelisted" property for this. If the property is not set, all libraries in the search paths are available in a namespace. If the property is set, only the libraries named are available. Bug: 119423884 Test: Boot with no-vendor-variant VNDK enabled using the new property. Change-Id: Id808c1733c8e2c2c3462b04c72461f9698403571
Diffstat (limited to 'linker/linker_namespaces.cpp')
-rw-r--r--linker/linker_namespaces.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/linker/linker_namespaces.cpp b/linker/linker_namespaces.cpp
index fd72cdc73..e870ef7ad 100644
--- a/linker/linker_namespaces.cpp
+++ b/linker/linker_namespaces.cpp
@@ -38,6 +38,14 @@ bool android_namespace_t::is_accessible(const std::string& file) {
return true;
}
+ if (!whitelisted_libs_.empty()) {
+ const char *lib_name = basename(file.c_str());
+ if (std::find(whitelisted_libs_.begin(), whitelisted_libs_.end(),
+ lib_name) == whitelisted_libs_.end()) {
+ return false;
+ }
+ }
+
for (const auto& dir : ld_library_paths_) {
if (file_is_in_dir(file, dir)) {
return true;