[PATCH] ld.so: Handle read-only dynamic section gracefully [BZ #28340]
Florian Weimer
fweimer@redhat.com
Fri Sep 17 04:00:41 GMT 2021
* Florian Weimer:
> * Siddhesh Poyarekar:
>
>> On 9/16/21 11:33 PM, Florian Weimer wrote:
>>> * H. J. Lu:
>>>
>>>> No. Relocation of vDSO dynamic section is done by elf_get_dynamic_info.
>>>> Here is a patch to remove the hack for vDSO.
>>> I have concerns that this does not actually work on MIPS. What
>>> happens
>>> if the object has a single RWX LOAD segment? What kind of flags will
>>> the link editor set on the DYNAMIC segment in this case? RWX or R, RX?
>>> I suspect it will be RWX, which means that we actually need the special
>>> case.
>>
>> The DYNAMIC segment flags will be based on .dynamic, which is
>> read-only for MIPS.
>
> Right, as far as I can tell BFD ld does not copy the W bit to the
> DYNAMIC segment even if it is located inside an RW LOAD segment. So
> unless there are old binaries floating around which were linked
> differently, the change should be correct for MIPS, too (and likewise
> for RISC-V, although I did not check that).
*sigh*
I checked riscv64-linux-gnu-rv64imafdc-lp64d now, and binutils BFD ld is
actually inconsistent with glibc there. There, DYNAMIC is RW:
LOAD 0x0003f0 0x00000000000003f0 0x00000000000003f0 0x0001c0 0x0001c0 RW 0x1000
DYNAMIC 0x000440 0x0000000000000440 0x0000000000000440 0x000170 0x000170 RW 0x8
So libphobos and others would have to change if we adopt H.J.'s patch, I
think. With it, RISC-V would be just like all the other non-MIPS
targets.
Thanks,
Florian
More information about the Libc-alpha
mailing list