Libraries without dt_soname are inaccessible

When linker tries to check if a library without dt_soname is accessible
it crashes. This change fixes this problem to return false instead
(making them inaccessible from other namespaces)

This went unnoticed because vendor libraries on current
devices all have dt_soname set. This was only discovered
on one of the newer devices which has a vendor prebuilt
library without a soname.

Bug: http://b/78661414
Bug: https://issuetracker.google.com/77287902
Test: cts-tradefed run commandAndExit cts -m CtsJniTestCases
Change-Id: Idb192b4ed7a810840ba2a9177bad2360ffbb75e2
This commit is contained in:
dimitry 2018-04-27 12:19:07 +02:00
parent 592bf711fd
commit 94f7a87510

View file

@ -54,6 +54,9 @@ struct android_namespace_link_t {
}
bool is_accessible(const char* soname) const {
if (soname == nullptr) {
return false;
}
return allow_all_shared_libs_ || shared_lib_sonames_.find(soname) != shared_lib_sonames_.end();
}