Load SP-HAL impls from the sphal namespace
SP-HALs are developed by vendors and thus they can use only a subset of
framework libraries that we call vndk-stable and subset of NDK
libraries. It consists of libc, libm, liblog, libz, libnativewindow,
libc++, ..., but not framework-only libraries such as libui, libandroid,
etc.
In order to enforce such restriction at run-time, we will use the linker
namespace. Specifically, we create a new namespace named 'sphal' and
configure it so that...
1) it can only search and load libraries from /vendor/lib,
2) it redirects the load/link request to the default namespace when the
allowed list of libraries are requested from the caller, and
3) it rejects to search/load any library other than 1) and 2).
The problem here is, libhidltransport, which is responsible for loading
SP_HALs into the memory space, need to tell the linker to load the
drivers from the separate namespace (the 'sphal' namespace other than
the default namespace. To specify the namespace, we need to use
android_dlopen_ext() instead of dlopen().
Bug: 34407260
Test: none. this should be no-op because there is no 'sphal' namespace
yet.
Change-Id: I9afb94722baa3d0157d37c82f64c69818c06bb3b
1 file changed