Merge "Refactor sanitized library on-disk layout - bionic."
This commit is contained in:
commit
2a41bf4190
1 changed files with 10 additions and 18 deletions
|
@ -83,15 +83,17 @@ static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
|
|||
#if defined(__LP64__)
|
||||
static const char* const kSystemLibDir = "/system/lib64";
|
||||
static const char* const kVendorLibDir = "/vendor/lib64";
|
||||
static const char* const kAsanSystemLibDir = "/data/lib64";
|
||||
static const char* const kAsanVendorLibDir = "/data/vendor/lib64";
|
||||
static const char* const kAsanSystemLibDir = "/data/asan/system/lib64";
|
||||
static const char* const kAsanVendorLibDir = "/data/asan/vendor/lib64";
|
||||
#else
|
||||
static const char* const kSystemLibDir = "/system/lib";
|
||||
static const char* const kVendorLibDir = "/vendor/lib";
|
||||
static const char* const kAsanSystemLibDir = "/data/lib";
|
||||
static const char* const kAsanVendorLibDir = "/data/vendor/lib";
|
||||
static const char* const kAsanSystemLibDir = "/data/asan/system/lib";
|
||||
static const char* const kAsanVendorLibDir = "/data/asan/vendor/lib";
|
||||
#endif
|
||||
|
||||
static const char* const kAsanLibDirPrefix = "/data/asan";
|
||||
|
||||
static const char* const kDefaultLdPaths[] = {
|
||||
kSystemLibDir,
|
||||
kVendorLibDir,
|
||||
|
@ -1897,20 +1899,10 @@ void* do_dlopen(const char* name, int flags,
|
|||
if (g_is_asan && translated_name != nullptr && translated_name[0] == '/') {
|
||||
char translated_path[PATH_MAX];
|
||||
if (realpath(translated_name, translated_path) != nullptr) {
|
||||
if (file_is_under_dir(translated_path, kSystemLibDir)) {
|
||||
asan_name_holder = std::string(kAsanSystemLibDir) + "/" +
|
||||
(translated_path + strlen(kSystemLibDir) + 1);
|
||||
if (file_exists(asan_name_holder.c_str())) {
|
||||
translated_name = asan_name_holder.c_str();
|
||||
PRINT("linker_asan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
|
||||
}
|
||||
} else if (file_is_under_dir(translated_path, kVendorLibDir)) {
|
||||
asan_name_holder = std::string(kAsanVendorLibDir) + "/" +
|
||||
(translated_path + strlen(kVendorLibDir) + 1);
|
||||
if (file_exists(asan_name_holder.c_str())) {
|
||||
translated_name = asan_name_holder.c_str();
|
||||
PRINT("linker_asan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
|
||||
}
|
||||
asan_name_holder = std::string(kAsanLibDirPrefix) + translated_path;
|
||||
if (file_exists(asan_name_holder.c_str())) {
|
||||
translated_name = asan_name_holder.c_str();
|
||||
PRINT("linker_asan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue