Fix is_greylisted check in case of an absolute path
Some apps are explicitly calling System.loadLibrary(.) for internal platform libraries like cutils. Bug: http://b/27100558 Change-Id: I765cf3fc542778d3b487069c9955d367840b3c05
This commit is contained in:
parent
535c5992d6
commit
b8e3769067
|
@ -163,6 +163,14 @@ static bool is_system_library(const std::string& realpath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dimitry): This is workaround for http://b/26394120 - it will be removed before the release
|
// TODO(dimitry): This is workaround for http://b/26394120 - it will be removed before the release
|
||||||
|
#if defined(__LP64__)
|
||||||
|
static const char* const kSystemLibDir = "/system/lib64";
|
||||||
|
#else
|
||||||
|
static const char* const kSystemLibDir = "/system/lib";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static std::string dirname(const char *path);
|
||||||
|
|
||||||
static bool is_greylisted(const char* name, const soinfo* needed_by) {
|
static bool is_greylisted(const char* name, const soinfo* needed_by) {
|
||||||
static const char* const kLibraryGreyList[] = {
|
static const char* const kLibraryGreyList[] = {
|
||||||
"libandroid_runtime.so",
|
"libandroid_runtime.so",
|
||||||
|
@ -191,6 +199,12 @@ static bool is_greylisted(const char* name, const soinfo* needed_by) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if this is an absolute path - make sure it points to /system/lib(64)
|
||||||
|
if (name[0] == '/' && dirname(name) == kSystemLibDir) {
|
||||||
|
// and reduce the path to basename
|
||||||
|
name = basename(name);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; kLibraryGreyList[i] != nullptr; ++i) {
|
for (size_t i = 0; kLibraryGreyList[i] != nullptr; ++i) {
|
||||||
if (strcmp(name, kLibraryGreyList[i]) == 0) {
|
if (strcmp(name, kLibraryGreyList[i]) == 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue