From: Kiyoung Kim Date: Wed, 27 May 2020 03:49:46 +0000 (+0900) Subject: Do not isolate sphal and vndk from unrestricted X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2e13598eb9;p=android-x86%2Fsystem-linkerconfig.git Do not isolate sphal and vndk from unrestricted 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 --- diff --git a/contents/namespace/rs.cc b/contents/namespace/rs.cc index 67626d2..4960547 100644 --- a/contents/namespace/rs.cc +++ b/contents/namespace/rs.cc @@ -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); diff --git a/contents/namespace/sphal.cc b/contents/namespace/sphal.cc index 70a8c2a..e1f83dd 100644 --- a/contents/namespace/sphal.cc +++ b/contents/namespace/sphal.cc @@ -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()) diff --git a/contents/namespace/vndk.cc b/contents/namespace/vndk.cc index 452abb1..a95db80 100644 --- a/contents/namespace/vndk.cc +++ b/contents/namespace/vndk.cc @@ -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 lib_paths; diff --git a/contents/section/unrestricted.cc b/contents/section/unrestricted.cc index ea1af8d..b63b1a6 100644 --- a/contents/section/unrestricted.cc +++ b/contents/section/unrestricted.cc @@ -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,