Refactor sanitized library on-disk layout - bionic.
This CL changes the linker to point to the newly refactored location of ASAN-ified libraries on disk. This supports changes made by the following CLs - https://android-review.googlesource.com/#/c/359087/ https://android-review.googlesource.com/#/c/359389/ Which refactor the on-disk location as follows: /data/lib* --> /data/asan/system/lib* /data/vendor/* --> /data/asan/vendor/* There are a couple of advantages to this, including better isolation from other components, and more transparent linker renaming and SELinux policies. Bug: 36574794 Bug: 36674745 Test: m -j40 && SANITIZE_TARGET="address" m -j40 and the device boots. All sanitized libraries are correctly located in /data/asan/*. Change-Id: Iad8b298a66c38eb0f6327f6b51027f0728aa7a40
This commit is contained in:
parent
ccec0f4c11
commit
4113def4fa
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