From 91a9e2544e9f75c7603f403898285ee1438f4121 Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Wed, 1 Apr 2020 17:03:30 +0900 Subject: [PATCH] Allow SPHAL namespace to access system in case of legacy In current there is limited link from sphal to platform in case of legacy device due to absence of VNDK related library list. Anyway, SPHAL namespace requires access to libraries under /system/lib which is VNDK-SP in treblelized device. This change adds extra access to system libs from SPHAL namespace in case of legacy device. Bug: 152932503 Test: m -j passed Change-Id: I93fc82a36cf3c2ee33c9bd1f2bb8371bb2d6d700 Merged-In: I93fc82a36cf3c2ee33c9bd1f2bb8371bb2d6d700 --- contents/namespace/sphal.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contents/namespace/sphal.cc b/contents/namespace/sphal.cc index 07bf2a8..2627788 100644 --- a/contents/namespace/sphal.cc +++ b/contents/namespace/sphal.cc @@ -44,15 +44,19 @@ Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) { ns.AddPermittedPath("/vendor/${LIB}", AsanPath::WITH_DATA_ASAN); ns.AddPermittedPath("/system/vendor/${LIB}", AsanPath::NONE); + if (ctx.IsApexBinaryConfig() && !ctx.IsVndkAvailable()) { + // If device is legacy, let Sphal libraries access to system lib path for + // VNDK-SP libraries + ns.AddSearchPath("/system/${LIB}", AsanPath::WITH_DATA_ASAN); + ns.AddPermittedPath("/system/${LIB}", AsanPath::WITH_DATA_ASAN); + } + if (ctx.IsApexBinaryConfig()) { if (ctx.IsVndkAvailable()) { ns.GetLink("vndk").AddSharedLib( Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", "")); ns.GetLink(ctx.GetSystemNamespaceName()) .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", "")); - } else { - // Add a link for libz.so which is llndk on devices where VNDK is not enforced. - ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("libz.so"); } } else { // Once in this namespace, access to libraries in /system/lib is restricted. -- 2.11.0