Why does _dl_protect_relro align the end address down?

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Jan 17 14:30:34 GMT 2023



On 17/01/23 11:16, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
> 
>> On 17/01/23 04:57, Florian Weimer via Libc-help wrote:
>>> * Joel Molin via Libc-help:
>>>
>>>> Since mprotect will protect entire pages anyway, wouldn't it make a lot
>>>> more sense here to say `end = ALIGN_UP(...)`? Apart from feeling more
>>>> intuitive, it also seems like it would avoid page size inconsistencies
>>>> between runtime and link editing like the one above.
>>>
>>> ALIGN_UP might make memory read-only that should not be.
>>>
>>> There's some discussion about the alignment here:
>>>
>>>   PT_GNU_RELRO is somewhat broken
>>>   <https://sourceware.org/pipermail/libc-alpha/2022-May/138638.html>
>>>
>>> I still think this is fairly broken, but there does not seem to be much
>>> desire to fix it.
>>
>> It was not clear to me from that discussion what you think it is still
>> broken with PT_GNU_RELRO.
> 
> Using ALIGN_DOWN for the start address can't be right.
> 

Do we have a bug report for this? Because H.J explanation [1] only describes
ld support for the end of the RO segment.

[1] https://sourceware.org/pipermail/libc-alpha/2022-May/138642.html


More information about the Libc-help mailing list