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

H.J. Lu hjl.tools@gmail.com
Thu Sep 16 04:30:04 GMT 2021


On Wed, Sep 15, 2021 at 9:28 PM Siddhesh Poyarekar
<siddhesh@sourceware.org> wrote:
>
> On 9/16/21 9:56 AM, H.J. Lu wrote:
> > On Wed, Sep 15, 2021 at 8:46 PM Siddhesh Poyarekar
> > <siddhesh@sourceware.org> wrote:
> >>
> >> On 9/16/21 7:53 AM, H.J. Lu wrote:
> >>>> What's the use case for read-only dynamic segments beyond VDSO?  That
> >>>> is, in what situations would one need to load an relocatable DSO (or
> >>>> execute a PIE program) that has a read-only dynamic segment?  On the
> >>>> other hand for DSOs without relocations, in what situations do you see a
> >>>> valid object having a read-only DYNAMIC segment?
> >>>
> >>> There is nothing wrong with read-only dynamic segment.
> >>
> >> Do you mean to say that the dynamic linker should always try to read
> >> such DSOs correctly and, like the vdso, allocate a writable dynamic
> >> array to work around the .dynamic section being read-only?
> >>
> >> I suppose if ld.so needs to handle it correctly, then it would also have
> >> to read the flags of the LOAD segment that covers the DYNAMIC segment to
> >> make sure that it has the right permission flags.
> >
> > What if DL_RO_DYN_SECTION is always 1?
> >
>
> That's only true for riscv and mips.  The addresses in the dynamic
> section are not updated in that case.
>

We can remove DL_RO_DYN_SECTION and delete !DL_RO_DYN_SECTION
codes.

-- 
H.J.


More information about the Libc-alpha mailing list