[PATCH] ld.so: Handle read-only dynamic section gracefully [BZ #28340]

Siddhesh Poyarekar siddhesh@sourceware.org
Thu Sep 16 05:36:07 GMT 2021


On 9/16/21 10:18 AM, Florian Weimer wrote:
> * H. J. Lu:
> 
>> There is nothing wrong with read-only dynamic segment.
> 
> A relocated DYNAMIC array is part of the ABI for !DL_RO_DYN_SECTION.
> ELF requires that DT_STRTAB is present.  DT_STRTAB needs relocation.
> This means that for !DL_RO_DYN_SECTION, the dynamic segment cannot be in
> a read-ony LOAD segment for a valid ELF file.

I think what H. J. means here is that we just never adjust DT_STRTAB and 
add l_addr to it every time we use it.  Basically, D_PTR is then always 
defined as:

# define D_PTR(map, i) ((map)->i->d_un.d_ptr + (map)->l_addr)

which could work (I think, I need to see if it breaks anything else) but 
will add an overhead every time these entries have to be accessed.

Siddhesh


More information about the Libc-alpha mailing list