From 94f7a87510138ac7b061611b181fa6e995d41764 Mon Sep 17 00:00:00 2001 From: dimitry Date: Fri, 27 Apr 2018 12:19:07 +0200 Subject: [PATCH] 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 --- linker/linker_namespaces.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h index 03520d79d..cd8b09d96 100644 --- a/linker/linker_namespaces.h +++ b/linker/linker_namespaces.h @@ -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(); }