[PATCH v2 1/3] elf: Iterate over loaded object list in _dl_determine_tlsoffset
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Jan 15 11:56:08 GMT 2025
On 15/01/25 06:11, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
>
>> On 13/01/25 09:32, Florian Weimer wrote:
>>> The old code used the slotinfo array as a scratch area to pass the
>>> list of TLS-using objects to _dl_determine_tlsoffset. All array
>>> entries are subsequently overwritten by _dl_add_to_slotinfo,
>>> except the first one. The link maps are usually not at their
>>> right position for their module ID in the slotinfo array, so
>>> the initial use of the slotinfo array would be incorrect if not
>>> for scratch purposes only.
>>>
>>> In _dl_tls_initial_modid_limit_setup, the old code relied that
>>> some link map was written to the first slotinfo entry. After the
>>> change, this no longer happens because TLS module ID zero is unused.
>>> It's also necessary to move the call after the real initialization
>>> of the slotinfo array.
>>
>> Ok, but I did not get what you mean by 'not int right position' fr
>> the slotinfo array. Is is that _dl_add_to_slotinfo might seem wrong
>> information that should not initialized?
>
> When used as a scratch array, index zero is populated with a link map.
> But there is no zero module ID (zero means no TLS block). So
> _dl_add_to_slotinfo never writes to index zero because the slotinfo
> array is indexed by TLS module ID.
Right, this explanation is more clear. Do you know why is happens to
work before, where _dl_add_to_slotinfo was not fully correct?
More information about the Libc-alpha
mailing list