[PATCH v6 1/2] elf: Properly align PT_LOAD segments [BZ #28676]

Florian Weimer fweimer@redhat.com
Mon Dec 13 13:26:20 GMT 2021


* H. J. Lu:

> On Mon, Dec 13, 2021 at 3:59 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * Szabolcs Nagy:
>>
>> >> What are the p_align values of the involved objects?  I would not expect
>> >> any changes on 32-bit Arm because p_align and the run-time page size
>> >> should match there.
>> >
>> > p_align is 64K
>> >
>> > and i see a lot of close to 64K PROT_NONE mappings
>> > left behind after many dlclose which creates a lot of
>> > vm fragmentation when dlopen/dlclose is called in a loop.
>> >
>> > (i think the mapping is at the beginning or end of
>> > the lib as some kind of padding and left behind after
>> > dlclose, but haven't confirmed this yet)
>>
>> Oh.  So why there is a real bug here, I think we need to discuss what
>> the change means for 64K p_align binaries on 4K kernels.  Do the
>> additional munmap calls matter for startup performance?
>
> We should align munmap arguments.

Sorry, I meant “while there is a real bug here”, that is: even if we fix
that, the additional munmap calls could hurt startup performance.

>> (I understand this is very much a correctness fix, but startup
>> performance matters as well.)
>>
>
> The kernel loader doesn't call munmap in this case.  Should
> we be concerned about the unused pages?

Which approach leads to fewer mappings that count against the map limit
(64K by default I believe)?

Thanks,
Florian



More information about the Libc-alpha mailing list