Greylist some of internal native libraries

This change is workaround for the http://b/26394120
greylisting the libraries used by some popular apps
to keep them working on dogfood builds. It will
be removed before the release.

Bug: http://b/26394120
Change-Id: I4e588b81da59f6f667aa9d2ef7e715d6607b9a36
This commit is contained in:
Dimitry Ivanov 2016-01-07 11:16:43 -08:00
parent 8f21ec0ba4
commit a8bda26ec9

View file

@ -153,6 +153,62 @@ static const char* const kAsanDefaultLdPaths[] = {
nullptr
};
// TODO(dimitry): This is workaround for http://b/26394120 - it will be removed before the release
static bool is_greylisted(const char* name) {
static const char* const kLibraryGreyList[] = {
"libLLVM.so",
"libRScpp.so",
"libaudioutils.so",
"libbacktrace.so",
"libbase.so",
"libbinder.so",
"libc++.so",
"libcamera_client.so",
"libcamera_metadata.so",
"libcommon_time_client.so",
"libcrypto.so",
"libcutils.so",
"libdrmframework.so",
"libexpat.so",
"libgui.so",
"libhardware.so",
"libicui18n.so",
"libicuuc.so",
"libmediautils.so",
"libmedia.so",
"libnativehelper.so",
"libnbaio.so",
"libnetd_client.so",
"libopus.so",
"libpowermanager.so",
"libsonivox.so",
"libspeexresampler.so",
"libpowermanager.so",
"libssl.so",
"libstagefright_avc_common.so",
"libstagefright_enc_common.so",
"libstagefright_foundation.so",
"libstagefright_omx.so",
"libstagefright_yuv.so",
"libstagefright.so",
"libsync.so",
"libui.so",
"libunwind.so",
"libutils.so",
"libvorbisidec.so",
nullptr
};
for (size_t i = 0; kLibraryGreyList[i] != nullptr; ++i) {
if (strcmp(name, kLibraryGreyList[i]) == 0) {
return true;
}
}
return false;
}
// END OF WORKAROUND
static const ElfW(Versym) kVersymNotNeeded = 0;
static const ElfW(Versym) kVersymGlobal = 1;
@ -1608,6 +1664,14 @@ static int open_library(android_namespace_t* ns,
fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_default_library_paths(), realpath);
}
// TODO(dimitry): workaround for http://b/26394120 - will be removed before the release
if (fd == -1 && ns != &g_default_namespace && is_greylisted(name)) {
// try searching for it on default_namespace default_library_path
fd = open_library_on_paths(zip_archive_cache, name, file_offset,
g_default_namespace.get_default_library_paths(), realpath);
}
// END OF WORKAROUND
return fd;
}
@ -1708,10 +1772,16 @@ static bool load_library(android_namespace_t* ns,
}
if (!ns->is_accessible(realpath)) {
// do not load libraries if they are not accessible for the specified namespace.
DL_ERR("library \"%s\" is not accessible for the namespace \"%s\"",
name, ns->get_name());
return false;
// TODO(dimitry): workaround for http://b/26394120 - will be removed before the release
if (is_greylisted(name)) {
DL_WARN("library \"%s\" (\"%s\") is not accessible for the namespace \"%s\" - the access is temporarily granted as a workaround for http://b/26394120",
name, realpath.c_str(), ns->get_name());
} else {
// do not load libraries if they are not accessible for the specified namespace.
DL_ERR("library \"%s\" is not accessible for the namespace \"%s\"",
name, ns->get_name());
return false;
}
}
soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags);