linker: check if needed_by is nullptr

Check if needed_by is nullptr in the grey-list warning
also print the name of the library making call to dlopen()

Bug: http://b/26749878
Change-Id: I4e16223a3e3d8d1539f855a0b3f199c5529027e0
This commit is contained in:
Dimitry Ivanov 2016-02-01 12:32:22 -08:00
parent 1516f02229
commit f53e7de4e9

View file

@ -1788,9 +1788,13 @@ static bool load_library(android_namespace_t* ns,
if (is_greylisted(name, needed_by)) {
// print warning only if needed by non-system library
if (needed_by == nullptr || !is_system_library(needed_by->get_realpath())) {
DL_WARN("library \"%s\" (\"%s\") needed by \"%s\" is not accessible for the namespace \"%s\""
const soinfo* needed_or_dlopened_by = task->get_needed_by();
DL_WARN("library \"%s\" (\"%s\") needed or dlopened by \"%s\" is not accessible for the namespace \"%s\""
" - the access is temporarily granted as a workaround for http://b/26394120",
name, realpath.c_str(), needed_by->get_realpath(), ns->get_name());
name, realpath.c_str(),
needed_or_dlopened_by == nullptr ? "(unknown)" :
needed_or_dlopened_by->get_realpath(),
ns->get_name());
}
} else {
// do not load libraries if they are not accessible for the specified namespace.