public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Carlos O'Donell <carlos@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	 Szabolcs Nagy <szabolcs.nagy@arm.com>,
	 gcc@gcc.gnu.org,  libc-alpha@sourceware.org,
	Iain Sandoe <iain@sandoe.co.uk>,
	 aburgess@redhat.com, lttng-dev@lists.lttng.org
Subject: Re: New TLS usage in libgcc_s.so.1, compatibility impact
Date: Mon, 15 Jan 2024 16:35:34 +0100	[thread overview]
Message-ID: <87jzoa6249.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <81279c5d-0b60-0e37-abe9-0936688b14fa@redhat.com> (Carlos O'Donell's message of "Mon, 15 Jan 2024 09:47:26 -0500")

* Carlos O'Donell:

> I agree. TLS should be seen more like .bss/.data rather than something
> that is allocated with malloc().

There wasn't consensus regarding this in 2014.  See below.

> If we leak memory via TLS that is a glibc bug that we can deal with,

This is something that libgcc_s.so.1 does in GCC 14 if the heap
trampolines are used.

> but making it easier to find glibc bugs is also a benefit to the
> community, but not as valuable a benefit as making TLS correctly
> async-signal safe.
>
> Likewise we need to discuss when the memory is allocated, regardless
> of which allocator is used, including allocation up-front at dlopen()
> time.
>> [1] https://sourceware.org/pipermail/libc-alpha/2014-January/047931.html

The change conflated multiple issues: sanitizer support,
async-signal-safe TLS access, and eager allocation of all TLS-related
memory, so that subsequent accesses cannot fail.  My impression was the
main point of contention was eager allocation because it was perceived
as a breaking semantic change.  Nowadays, as long as we are willing to
maintain both allocator variants, we could offer a choice between them
controlled by a tunable.  For sanitizer compatibility, we could perform
eager allocation using malloc.  It's probably a good idea to do it this
way anyway because a separate mmap-based allocator would increase TLB
pressure.

Thanks,
Florian


  reply	other threads:[~2024-01-15 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13 12:49 Florian Weimer
2024-01-15 12:46 ` Szabolcs Nagy
2024-01-15 13:55   ` Adhemerval Zanella Netto
2024-01-15 14:47     ` Carlos O'Donell
2024-01-15 15:35       ` Florian Weimer [this message]
2024-01-15 15:38         ` Iain Sandoe
2024-01-15 16:44           ` Florian Weimer
2024-01-15 16:29         ` Joseph Myers
2024-01-15 19:05 ` [lttng-dev] " Mathieu Desnoyers
2024-01-15 19:42   ` Florian Weimer
2024-01-15 20:08     ` Mathieu Desnoyers

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

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

  git send-email \
    --in-reply-to=87jzoa6249.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=aburgess@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=libc-alpha@sourceware.org \
    --cc=lttng-dev@lists.lttng.org \
    --cc=szabolcs.nagy@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).