Re: Aligning tcmalloc with glibc 2.35 rseq ABI

From: Chris Kennelly
Date: Tue Feb 01 2022 - 15:33:36 EST


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.

I saw https://lkml.org/lkml/2022/1/24/859 mention using %gs, but it
also mentions consulting "rseq_offset" in the address calculation. Is
rseq_offset something I can resolve to a constant or would I need to
access a global for it, or does glibc take care of initializing %gs to
the address of the structure registered with the kernel (for the
current thread)?

Thanks,
Chris


On Tue, Feb 1, 2022 at 9:58 AM Mathieu Desnoyers
<mathieu.desnoyers@xxxxxxxxxxxx> wrote:
>
> Hi Chris,
>
> You will probably want to have a look at the userspace rseq ABI exposed by glibc 2.35 to ensure
> tcmalloc becomes compatible with it.
>
> If it helps, you can have a look at how I modified librseq to play nicely with glibc 2.35:
>
> https://git.kernel.org/pub/scm/libs/librseq/librseq.git/
>
> Most relevant bits:
>
> https://git.kernel.org/pub/scm/libs/librseq/librseq.git/tree/src/rseq.c#n108
>
> Thanks,
>
> Mathieu
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com