Re: Aligning tcmalloc with glibc 2.35 rseq ABI

From: Mathieu Desnoyers
Date: Wed Feb 02 2022 - 06:36:49 EST


----- On Feb 2, 2022, at 3:41 AM, Florian Weimer fweimer@xxxxxxxxxx wrote:

> * Florian Weimer:
>
>> * Chris Kennelly:
>>
>>> Thanks for the heads up.
>>>
>>> I did have a question about whether the new protocol would introduce
>>> an extra memory reference while initializing a critical section.
>>>
>>> * With initial-exec TLS, I can directly reference __rseq_abi.
>>> * With the new ABI, I might need to ask glibc for the address of the
>>> registered rseq structure in its thread data.
>>
>> You can write __rseq_offset to a static/hidden variable in an ELF
>> constructor, and then use pretty much the same assembler sequences as
>> for initial-exec TLS on most architectures.
>
> And now I'm kind of worried that we should be using ptrdiff_t for
> __rseq_offset because that's what the initial-exec relocations use. 8-/

I suspect the underlying question here is: how likely is it that a libc
requires an offset of more than 2GB either way from the thread pointer
to allocate its rseq thread area on a 64-bit architecture ?

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com