aboutsummaryrefslogtreecommitdiffstats
path: root/linker/linker_phdr.h
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@gmail.com>2012-08-14 12:30:09 +0200
committerArd Biesheuvel <ard.biesheuvel@gmail.com>2012-08-14 19:38:28 +0200
commit12c78bbded8ec03f821dfa09174464c04836e4ea (patch)
treebcf31e000dc214688694a6538568b3a49624352c /linker/linker_phdr.h
parent54655eaf92ca91bfe2fa293896059a181e27b6eb (diff)
downloadandroid_bionic-12c78bbded8ec03f821dfa09174464c04836e4ea.tar.gz
android_bionic-12c78bbded8ec03f821dfa09174464c04836e4ea.tar.bz2
android_bionic-12c78bbded8ec03f821dfa09174464c04836e4ea.zip
linker: avoid clobbering the .dynamic section of shared libs
This patch removes the DT_NEEDED hack which stores pointers to soinfo structs in the .dynamic section of the library being loaded. Instead, it caches the soinfo struct pointers on the stack during relocation time. After relocation time, i.e. when calling constructors and destructors of the shared library and its dependencies, uncached access is used instead, doing lookups using the string table entries pointed to by the DT_NEEDED entries. By removing this hack, it is no longer needed to undo the PT_GNURELRO protection, i.e., all non-writable mappings can remain non-writable during their entire lifespan. Even though, strictly speaking, the algorithmic complexity has increased somewhat, the real-world adverse effect is negligible on the systems I have tested. Change-Id: I2361502560b96b5878f7f94a8e8a215350d70d64 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
Diffstat (limited to 'linker/linker_phdr.h')
-rw-r--r--linker/linker_phdr.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h
index 753c7e76d..a75926298 100644
--- a/linker/linker_phdr.h
+++ b/linker/linker_phdr.h
@@ -86,11 +86,6 @@ phdr_table_protect_gnu_relro(const Elf32_Phdr* phdr_table,
int phdr_count,
Elf32_Addr load_bias);
-int
-phdr_table_unprotect_gnu_relro(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias);
-
const Elf32_Phdr*
phdr_table_get_loaded_phdr(const Elf32_Phdr* phdr_table,
int phdr_count,
@@ -105,10 +100,12 @@ phdr_table_get_arm_exidx(const Elf32_Phdr* phdr_table,
unsigned* arm_exidix_count);
#endif
-Elf32_Addr*
+void
phdr_table_get_dynamic_section(const Elf32_Phdr* phdr_table,
int phdr_count,
- Elf32_Addr load_bias);
+ Elf32_Addr load_bias,
+ Elf32_Addr** dynamic,
+ size_t* dynamic_count);
#ifdef __cplusplus
};