From 576662ab0698b3189b2e7cd5eecb5526ceead93e Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 9 Aug 2024 23:12:03 +0000 Subject: libbinder: allow libbinder_ndk + libbinder.vendor Due to messed up fuzzing linker namespaces, which are being fixed, when fuzzers are configured as: - vendor: true, - shared_libs: [... "libbinder_ndk" ...], then the runtime libraries used are like this: - /data/fuzz/x86_64/lib/vendor/libbinder.so - /system/lib64/libbinder_ndk.so This is not a correct configuration. However, we can change the way openDeclaredPassthroughHal is disabled in order to provide the same ELF-level interface (that libbinder_ndk expects) from libbinder as libbinder.vendor. Future considertions: - very soon, we need to remove this implicit requirement on the dependencies of ll-ndk libraries, by fixing fuzzer linker namespaces - vendors should be able to dlopen same-process stable C HALs, as system can, but this requires additional apexd APIs available to vendor Bugs: me Test: run all service fuzzers, no startup crashes Change-Id: Icf09de3ca048b542d7c22e6f4ca030977be3dff4 --- libs/binder/IServiceManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libs/binder/IServiceManager.cpp') diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 17e522d921..411163257c 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -247,8 +247,11 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid, bool logP } } +#endif //__ANDROID_VNDK__ + void* openDeclaredPassthroughHal(const String16& interface, const String16& instance, int flag) { -#if defined(__ANDROID__) && !defined(__ANDROID_RECOVERY__) && !defined(__ANDROID_NATIVE_BRIDGE__) +#if defined(__ANDROID__) && !defined(__ANDROID_VENDOR__) && !defined(__ANDROID_RECOVERY__) && \ + !defined(__ANDROID_NATIVE_BRIDGE__) sp sm = defaultServiceManager(); String16 name = interface + String16("/") + instance; if (!sm->isDeclared(name)) { @@ -268,8 +271,6 @@ void* openDeclaredPassthroughHal(const String16& interface, const String16& inst #endif } -#endif //__ANDROID_VNDK__ - // ---------------------------------------------------------------------- ServiceManagerShim::ServiceManagerShim(const sp& impl) { -- cgit v1.2.3-59-g8ed1b