diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-07 16:20:48 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-07 16:20:48 -0800 |
commit | 4238c50072f2d7546118ed52220c398782c45e9d (patch) | |
tree | ac3b6b98c526855f6051c47a96d5ce8c3f2e158e /linker/linker.cpp | |
parent | 91d934ac73ae5a198ae0db4203c8fcf79e4df288 (diff) | |
parent | 807032d0e12877a4c92ac7f6072d5dd9e1f76f3c (diff) | |
download | bionic-4238c50072f2d7546118ed52220c398782c45e9d.zip bionic-4238c50072f2d7546118ed52220c398782c45e9d.tar.gz bionic-4238c50072f2d7546118ed52220c398782c45e9d.tar.bz2 |
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/bionic into cm-13.0
Android 6.0.1 release 3
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 99807f1..9885b69 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -37,6 +37,7 @@ #include <string.h> #include <sys/mman.h> #include <sys/param.h> +#include <sys/prctl.h> #include <unistd.h> #include <new> @@ -317,6 +318,13 @@ static void parse_LD_PRELOAD(const char* path) { static bool realpath_fd(int fd, std::string* realpath) { std::vector<char> buf(PATH_MAX), proc_self_fd(PATH_MAX); snprintf(&proc_self_fd[0], proc_self_fd.size(), "/proc/self/fd/%d", fd); + // set DUMPABLE to 1 to access /proc/self/fd + int dumpable = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0); + prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + auto guard = make_scope_guard([&]() { + // restore dumpable + prctl(PR_SET_DUMPABLE, dumpable, 0, 0, 0); + }); if (readlink(&proc_self_fd[0], &buf[0], buf.size()) == -1) { PRINT("readlink('%s') failed: %s [fd=%d]", &proc_self_fd[0], strerror(errno), fd); return false; @@ -1534,13 +1542,14 @@ static bool find_libraries(soinfo* start_with, const char* const library_names[] // Step 1: load and pre-link all DT_NEEDED libraries in breadth first order. for (LoadTask::unique_ptr task(load_tasks.pop_front()); task.get() != nullptr; task.reset(load_tasks.pop_front())) { - soinfo* si = find_library_internal(load_tasks, task->get_name(), rtld_flags, extinfo); + soinfo* needed_by = task->get_needed_by(); + + soinfo* si = find_library_internal(load_tasks, task->get_name(), + rtld_flags, needed_by == nullptr ? extinfo : nullptr); if (si == nullptr) { return false; } - soinfo* needed_by = task->get_needed_by(); - if (needed_by != nullptr) { needed_by->add_child(si); } @@ -3004,6 +3013,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t& // TODO (dimitry): remove != __ANDROID_API__ check once http://b/20020312 is fixed if (get_application_target_sdk_version() != __ANDROID_API__ && get_application_target_sdk_version() > 22) { + PRINT("%s: has text relocations", get_realpath()); DL_ERR("%s: has text relocations", get_realpath()); return false; } |