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:
@@ -1149,6 +1149,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
||||
such a segment to avoid a crash later. */
|
||||
l->l_ld = (void *) ph->p_vaddr;
|
||||
l->l_ldnum = ph->p_memsz / sizeof (ElfW(Dyn));
|
||||
l->l_ld_readonly = (ph->p_flags & PF_W) == 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1292,7 +1293,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
||||
else
|
||||
l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr);
|
||||
|
||||
elf_get_dynamic_info (l, NULL);
|
||||
elf_get_dynamic_info (l);
|
||||
|
||||
/* Make sure we are not dlopen'ing an object that has the
|
||||
DF_1_NOOPEN flag set, or a PIE object. */
|
||||
|
Reference in New Issue
Block a user