[PATCH] Linux: Remove rseq support

Szabolcs Nagy szabolcs.nagy@arm.com
Fri Jul 17 07:45:22 GMT 2020


The 07/16/2020 22:02, Florian Weimer wrote:
> * Matheus Castanho:
> 
> > On 7/16/20 2:52 PM, Florian Weimer wrote:
> >> * Matheus Castanho:
> >> 
> >>>> diff --git a/csu/libc-tls.c b/csu/libc-tls.c
> >>>> index 3f1655f264..06e76bd395 100644
> >>>> --- a/csu/libc-tls.c
> >>>> +++ b/csu/libc-tls.c
> >>>> @@ -112,12 +112,6 @@ __libc_setup_tls (void)
> >>>>    size_t tcb_offset;
> >>>>    const ElfW(Phdr) *phdr;
> >>>>  
> >>>> -  /* libc.so with rseq has TLS with 32-byte alignment.  Static dlopen
> >>>> -     requires at least 32-byte alignment as well, otherwise loading
> >>>> -     libc.so will always fail.  */
> >>>> -  if (max_align < 32)
> >>>> -    max_align = 32;
> >>>> -
> >>>>    struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
> >>>>  
> >>>>    /* Look through the TLS segment if there is any.  */
> >>>> diff --git a/elf/dl-tls.c b/elf/dl-tls.c
> >>>> index 772e70d0f6..9a17427047 100644
> >>>> --- a/elf/dl-tls.c
> >>>> +++ b/elf/dl-tls.c
> >>>> @@ -55,7 +55,7 @@
> >>>>     but come on top when computing the number of namespaces.  */
> >>>>  
> >>>>  /* Size of initial-exec TLS in libc.so.  */
> >>>> -#define LIBC_IE_TLS 192
> >>>> +#define LIBC_IE_TLS 160
> >>>
> >>> ... this change?
> >> 
> >> It should work, given that we removed 32 bytes of TLS data with the
> >> other changes.
> >> 
> >> Did you observe the failure on powerpc64le?
> >
> > Actually, on powerpc, powerpc64 and powerpc64le. The test is currently
> > failing on all of them.
> 
> I'm not sure if the test is correct.
> 
> As far as I can see, the static TLS reserve not used up by optimizations
> is just 512 bytes, but the static TLS sizes of the subsequent modules
> are:
> 
>   elf/tst-tls-ie-mod4.so   1024 bytes
>   elf/tst-tls-ie-mod5.so   128 bytes
>   elf/tst-tls-ie-mod6.so   576 bytes
> 
> I think the implementation guarantees that this works only if the total
> static TLS usage from dlopen is at most 512.
> 
> Since the test does not use multiple namespaces, it happened to pass
> with the 96 or so extra bytes of TLS data we had before adjusting
> LIBC_IE_TLS.

the test is doing its thing.

its testing an internal contract about static tls usage
as documented in the commit message.

192 bytes is reserved for the libc (this was decided with
rseq in mind), this is larger than needed so that we don't
have to change the contract often: doing that affects
stack usage too and how the tls optimizations are done etc.

if we change the contract the test should change too, and
we should adjust the size reserved for optimizations too:
the idea was to keep static tls usage the same for now,
just allocate them into separate buckets of libc, ie tls
and tls optimizations.



More information about the Libc-alpha mailing list