libhidlbase: avoid dlclose
HIDL passthrough has a fatal design flaw! It's not known which
implementation library serves which instance name.
dlclose is extremely problematic:
- some symbols (e.g. like [[clang::no_destroy]] or equiv) may be leaked.
- binder, given multithreaded environment, might have other threads
using this data
- binder, may send ownership of some of this data out of process
So, proactively removing dlclose here.
As a side effect, this may mean we are keeping extra libraries open when
they were closed before. Though, note:
a. ephemeral dlopen/dlclose is a mostly silent cost which is now visible
b. dlopen/dlclose will definitely be leaking memory
c. for passthrough HALs used by system, only one instance is supported,
so we shouldn't have this problem
d. passthrough HALs are used as implementation detail for vendors, but:
i. (a)/(b) still apply here
ii. most vendor HALs are direct implemenations now (not passthrough).
If this turns out to take more memory on some devices, we can prefer to
improve HIDL's passthrough infrastructure to know which library it needs
to open for which implementation. This would improve device performance
over the existing baseline.
Fixes: 180501607
Test: N/A
Change-Id: I8555ce46b497be4df9d02490bbbe78dbf3255d32
1 file changed