mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
ld.so: Replace DL_RO_DYN_SECTION with dl_relocate_ld [BZ #28340]
We can't relocate entries in dynamic section if it is readonly: 1. Add a l_ld_readonly field to struct link_map to indicate if dynamic section is readonly and set it based on p_flags of PT_DYNAMIC segment. 2. Replace DL_RO_DYN_SECTION with dl_relocate_ld to decide if dynamic section should be relocated. 3. Remove DL_RO_DYN_TEMP_CNT. 4. Don't use a static dynamic section to make readonly dynamic section in vDSO writable. 5. Remove the temp argument from elf_get_dynamic_info. This fixes BZ #28340. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
@@ -40,7 +40,17 @@ _dl_relocate_static_pie (void)
|
||||
|
||||
/* Read our own dynamic section and fill in the info array. */
|
||||
main_map->l_ld = ((void *) main_map->l_addr + elf_machine_dynamic ());
|
||||
elf_get_dynamic_info (main_map, NULL);
|
||||
|
||||
const ElfW(Phdr) *ph, *phdr = GL(dl_phdr);
|
||||
size_t phnum = GL(dl_phnum);
|
||||
for (ph = phdr; ph < &phdr[phnum]; ++ph)
|
||||
if (ph->p_type == PT_DYNAMIC)
|
||||
{
|
||||
main_map->l_ld_readonly = (ph->p_flags & PF_W) == 0;
|
||||
break;
|
||||
}
|
||||
|
||||
elf_get_dynamic_info (main_map);
|
||||
|
||||
# ifdef ELF_MACHINE_BEFORE_RTLD_RELOC
|
||||
ELF_MACHINE_BEFORE_RTLD_RELOC (main_map->l_info);
|
||||
|
Reference in New Issue
Block a user