Add VNDK APEX path as permitted paths of sphal

With VNDK APEX, the path for VNDK libs has been changed
from /system/lib/vndk-VER to /apex/com.android.vndk.vVER/lib

But we need to keep older location since it should run on
older version of system due to APEX requirements.

When VNDK APEX is used, older location is just a symlink to a new
location. So we have to add a new location as permitted path. Otherwise,
linker would fail because it checks accessibility using realpath().

Test: add a vendor binary to /apex/com.android.media.swcodec/bin
      which opens /system/lib/vndk-sp{VNDK_VER}/hw/android.hidl.memory@1.0-impl.so
      via android_load_sphal_library()
Bug: 142912195

Change-Id: I13779679af5cf7f687a726afe0b6118e15cf1869
diff --git a/apex/ld.config.txt b/apex/ld.config.txt
index af8ec06..f56e1b5 100644
--- a/apex/ld.config.txt
+++ b/apex/ld.config.txt
@@ -44,7 +44,7 @@
 namespace.platform.asan.search.paths += /apex/com.android.runtime/${LIB}
 
 # /system/lib/libc.so, etc are symlinks to /apex/com.android.lib/lib/bionic/libc.so, etc.
-# Add /apex/... pat to the permitted paths because linker uses realpath(3)
+# Add /apex/... path to the permitted paths because linker uses realpath(3)
 # to check the accessibility of the lib. We could add this to search.paths
 # instead but that makes the resolution of bionic libs be dependent on
 # the order of /system/lib and /apex/... in search.paths. If /apex/...
@@ -131,3 +131,9 @@
 
 # Add a link for libz.so which is llndk on devices where VNDK is not enforced.
 namespace.sphal.link.platform.shared_libs += libz.so
+
+# With VNDK APEX, /system/${LIB}/vndk-sp${VNDK_VER} is a symlink to the following.
+# Add /apex/... path to the permitted paths because linker uses realpath(3)
+# to check the accessibility of the lib.
+namespace.sphal.permitted.paths += /apex/com.android.vndk.${VNDK_APEX_VER}/${LIB}
+namespace.sphal.asan.permitted.paths += /apex/com.android.vndk.${VNDK_APEX_VER}/${LIB}