Why does _dl_protect_relro align the end address down?

Florian Weimer fweimer@redhat.com
Tue Jan 17 14:16:42 GMT 2023


* 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.

Thanks,
Florian



More information about the Libc-help mailing list