From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp001-out.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) by sourceware.org (Postfix) with ESMTPS id 3469038582A7 for ; Mon, 15 Jan 2024 15:38:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3469038582A7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sandoe.co.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3469038582A7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=85.119.248.222 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705333090; cv=none; b=mcJDBhBmiYm66a4IWzcIbAdkawaEPwcFJnrZibAW+ts9RY2hFVEivu0IU4YhHpkK6BztVq5O838FEoEgNDojq8hZKGSeaVvRGfXFxmddun+6NgY+7YVNd3N6M6uxTA9bc5AcWP3QLKmanXXPVI06KlgwdfNq654xCksr+KoLL/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705333090; c=relaxed/simple; bh=5/mW+m7Y1Ow0C/8TNLZ1em/4yk84Ylo8P4OSuQpswZ8=; h=Mime-Version:Subject:From:Date:Message-Id:To; b=LdcBrdjOU0hA0Iw2GVgkfEwwJf0jVbNi2E1FFgBYwAplpLY5khH33qtMlKFdbZXn9n+dDSkLn1IdTEVHo0yO6jJ2iV9/FvT7k0YmTOw0kOX/gM86Q1b7jRpZGr36D/Hx7PwH2516Rbdax6nlhr7DAC+KHYyalivW3Ao5dG0RiAs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: (qmail 93612 invoked from network); 15 Jan 2024 15:38:06 -0000 X-APM-Out-ID: 17053330869361 X-APM-Authkey: 257869/1(257869/1) 10 Received: from unknown (HELO smtpclient.apple) (81.138.1.83) by smtp001.apm-internet.net with SMTP; 15 Jan 2024 15:38:06 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: New TLS usage in libgcc_s.so.1, compatibility impact From: Iain Sandoe In-Reply-To: <87jzoa6249.fsf@oldenburg.str.redhat.com> Date: Mon, 15 Jan 2024 15:38:06 +0000 Cc: Carlos O'Donell , Adhemerval Zanella Netto , Szabolcs Nagy , GCC Development , libc-alpha@sourceware.org, aburgess@redhat.com, lttng-dev@lists.lttng.org Content-Transfer-Encoding: 7bit Message-Id: <4F19001F-1F46-49EC-8A69-11F7CF5017B2@sandoe.co.uk> References: <8734v1ieke.fsf@oldenburg.str.redhat.com> <81279c5d-0b60-0e37-abe9-0936688b14fa@redhat.com> <87jzoa6249.fsf@oldenburg.str.redhat.com> To: Florian Weimer X-Mailer: Apple Mail (2.3696.120.41.1.4) X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,KAM_COUK,KAM_DMARC_STATUS,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > On 15 Jan 2024, at 15:35, Florian Weimer wrote: > > * 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. Is there a GCC BZ for this? (if there is something we should address in GCC, it would be better sooner) Iain >> 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 >