unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: nd <nd@arm.com>, GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Reserve static TLS for dynamically loaded initial-exec TLS only [BZ #25051]
Date: Tue, 7 Jan 2020 12:50:17 +0000	[thread overview]
Message-ID: <5533fb62-c336-45b3-71ec-30c5e7d7ac4c@arm.com> (raw)
In-Reply-To: <87lfqjv56h.fsf@oldenburg2.str.redhat.com>

On 07/01/2020 12:09, Florian Weimer wrote:
> * Szabolcs Nagy:
> 
>> This patch reserves 128 bytes of the surplus TLS that is not used
>> opportunistically. TLS_STATIC_SURPLUS is currently 1664, so this still
>> allows 1536 bytes for opportunistic use. A new test is added to verify
>> this ABI contract: dynamic loading of libraries with initial-exec TLS
>> is supported up to 128 bytes in total on all targets. This should be
>> enough for system libraries such as libgomp.
> 
> I'm not sure if it's enough for loading another libc.so.6 via dlmopen.
> Have you tested this, by chance?

i haven't tested, but that wont work reliably with
this patch.

libc.so on aarch64 has 144 byte TLS (8byte alignmed),
so the reserved 128byte surplus TLS is not enough
(can be increased to 144 though).

however if a lib with ie TLS is loaded before the static
TLS runs out then that works: the 128byte reserve will be
kept available until the 'opportunistic' part of TLS runs
out and then the reserve can only be used for ie TLS.
(so early dlmopen of libc.so.6 and later dlopen of libgomp
works)

this may not be an ideal solution: if all the ie TLS libs
are loaded early then reserving 128 byte at the end is not
that useful.

but using dlmopen to load multiple instances of libc and
libgomp and libopengl etc will not work reliably because
we can't keep enough static TLS reserve for that: if that's
the preferred behaviour then glibc should not use static
TLS opportunistically for TLSDESC and ppc TLS opt.

  reply	other threads:[~2020-01-07 12:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 11:54 [PATCH] Reserve static TLS for dynamically loaded initial-exec TLS only [BZ #25051] Szabolcs Nagy
2020-01-07 12:09 ` Florian Weimer
2020-01-07 12:50   ` Szabolcs Nagy [this message]
2020-02-13 16:38     ` Szabolcs Nagy
2020-02-13 18:07       ` Carlos O'Donell
2020-02-17 16:01         ` Florian Weimer
2020-02-20 15:05           ` Carlos O'Donell
2020-02-21 12:58             ` Florian Weimer
2020-02-27 16:21               ` Szabolcs Nagy
2020-02-27 16:31                 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5533fb62-c336-45b3-71ec-30c5e7d7ac4c@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).