summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authordimitry <dimitry@google.com>2018-05-09 15:22:38 +0200
committerdimitry <dimitry@google.com>2018-05-12 10:58:00 +0200
commit8b142566e346beeabca774e01f81934280bcd6b6 (patch)
treef55079f62d362e1f076a2152055c1133ae648674 /linker/linker_main.cpp
parente0906d8f558675f77636f79e9f232329a3b95e2e (diff)
vdso should be available in all namespaces
vdso should be available in all namespaces when present. This bug went undetected because the way libc currently uses vdso (it does all the lookups itself). This makes it available for the programs that want to take advantage by dlopening it. Bug: http://b/73105445 Bug: http://b/79561555 Test: adb shell /data/nativetest/arm/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl.exec_with_ld_config_file Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl* Change-Id: I8eae0c9848f256190d1c9ec85d10dc6ce383a8bc (cherry picked from commit 69c68c46ac18a440bf1c0447d8343a6dbad595f1)
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index dc1fa7550..00c72d02a 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -64,6 +64,7 @@ static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
static soinfo* solist;
static soinfo* sonext;
static soinfo* somain; // main process, always the one after libdl_info
+static soinfo* vdso; // vdso if present
void solist_add_soinfo(soinfo* si) {
sonext->next = si;
@@ -104,6 +105,10 @@ soinfo* solist_get_somain() {
return somain;
}
+soinfo* solist_get_vdso() {
+ return vdso;
+}
+
int g_ld_debug_verbosity;
abort_msg_t* g_abort_message = nullptr; // For debuggerd.
@@ -158,6 +163,8 @@ static void add_vdso(KernelArgumentBlock& args) {
si->set_dt_flags_1(si->get_dt_flags_1() | DF_1_NODELETE);
si->set_linked();
si->call_constructors();
+
+ vdso = si;
}
/* gdb expects the linker to be in the debug shared object list.
@@ -280,6 +287,8 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args) {
}
}
+ add_vdso(args);
+
struct stat file_stat;
// Stat "/proc/self/exe" instead of executable_path because
// the executable could be unlinked by this point and it should
@@ -366,8 +375,6 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args) {
}
}
- add_vdso(args);
-
// Load ld_preloads and dependencies.
std::vector<const char*> needed_library_name_list;
size_t ld_preloads_count = 0;