OSDN Git Service

Do not isolate sphal and vndk from unrestricted
authorKiyoung Kim <kiyoungkim@google.com>
Wed, 27 May 2020 03:49:46 +0000 (12:49 +0900)
committerKiyoung Kim <kiyoungkim@google.com>
Wed, 27 May 2020 04:45:09 +0000 (13:45 +0900)
After introducing sphal and vndk namespaces, some tests fails due to
existance of sphal namespace in unrestricted section. This change
updates sphal and vndk not to be isolated from unrestricted namespaces
so test can dlopen libraries from custom path (such as /data/local) as required.
In addition, include rs namespace in unrestricted section so
Renderscript test can use rs libraries from unrestricted section.

Bug: 156449540
Test: RenderscriptHidlTest passed with aosp_crosshatch-userdebug
Change-Id: Ib1526e225971312f126d75f26d7aa5c523011922

contents/namespace/rs.cc
contents/namespace/sphal.cc
contents/namespace/vndk.cc
contents/section/unrestricted.cc

index 67626d2..4960547 100644 (file)
@@ -28,7 +28,8 @@ namespace android {
 namespace linkerconfig {
 namespace contents {
 Namespace BuildRsNamespace([[maybe_unused]] const Context& ctx) {
-  Namespace ns("rs", /*is_isolated=*/true, /*is_visible=*/true);
+  Namespace ns(
+      "rs", /*is_isolated=*/!ctx.IsUnrestrictedSection(), /*is_visible=*/true);
 
   ns.AddSearchPath("/odm/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
   ns.AddSearchPath("/vendor/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
index 70a8c2a..e1f83dd 100644 (file)
@@ -35,7 +35,9 @@ namespace contents {
 Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) {
   // Visible to allow use with android_dlopen_ext, and with
   // android_link_namespaces in libnativeloader.
-  Namespace ns("sphal", /*is_isolated=*/true, /*is_visible=*/true);
+  Namespace ns("sphal",
+               /*is_isolated=*/!ctx.IsUnrestrictedSection(),
+               /*is_visible=*/true);
   ns.AddSearchPath("/odm/${LIB}", AsanPath::WITH_DATA_ASAN);
   ns.AddSearchPath("/vendor/${LIB}", AsanPath::WITH_DATA_ASAN);
   ns.AddSearchPath("/vendor/${LIB}/hw", AsanPath::NONE);
@@ -63,7 +65,7 @@ Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) {
     // Only libs listed here can be used. Order is important here as the
     // namespaces are tried in this order. rs should be before vndk because both
     // are capable of loading libRS_internal.so
-    if (ctx.IsSystemSection()) {
+    if (ctx.IsSystemSection() || ctx.IsUnrestrictedSection()) {
       ns.GetLink("rs").AddSharedLib("libRS_internal.so");
     }
     ns.GetLink(ctx.GetSystemNamespaceName())
index 452abb1..a95db80 100644 (file)
@@ -48,7 +48,7 @@ Namespace BuildVndkNamespace([[maybe_unused]] const Context& ctx,
   // in libnativeloader. Otherwise it isn't isolated, so visibility doesn't
   // matter.
   Namespace ns(name,
-               /*is_isolated=*/is_system_or_unrestricted_section,
+               /*is_isolated=*/ctx.IsSystemSection() || ctx.IsApexBinaryConfig(),
                /*is_visible=*/is_system_or_unrestricted_section);
 
   std::vector<std::string> lib_paths;
index ea1af8d..b63b1a6 100644 (file)
@@ -41,6 +41,7 @@ Section BuildUnrestrictedSection(Context& ctx) {
   if (ctx.IsVndkAvailable()) {
     namespaces.emplace_back(BuildSphalNamespace(ctx));
     namespaces.emplace_back(BuildVndkNamespace(ctx, VndkUserPartition::Vendor));
+    namespaces.emplace_back(BuildRsNamespace(ctx));
   }
 
   return BuildSection(ctx,