OSDN Git Service

Allow SPHAL namespace to access system in case of legacy
authorKiyoung Kim <kiyoungkim@google.com>
Wed, 1 Apr 2020 08:03:30 +0000 (17:03 +0900)
committerKiyoung Kim <kiyoungkim@google.com>
Thu, 2 Apr 2020 08:24:41 +0000 (17:24 +0900)
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

index 07bf2a8..2627788 100644 (file)
@@ -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.