From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A0D083858418 for ; Mon, 15 Jan 2024 15:35:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0D083858418 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A0D083858418 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705332942; cv=none; b=HzVMEmVno0QgMkhQBr5yoPoiiyujVEibYtUAa9HIhA00DeG1j/A1d5vr/q3JeDy0K5o8rNSy0LjnA50edHQhX4FOZRgtBN3oiwHLkn1mEsycbHjm3moicvBSnZFNXlS8+yPdCstur9hovcSaaiuby8FRm02r8FQs3wXU4vFsQCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705332942; c=relaxed/simple; bh=5Ahzyql5+S+Ij8CBrYv5V1eDLy8LCPXoarkMwvxvmqM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=G46m2X5Ze7mLE5HRC9aVOXKnIis7n3YKjGlTJUABq2J5Fp1Xx5RYKwswQdwDkWZw0X7kl/MVmKHXUyt3exayJVVoBIx15fLrb/vNYS+U9MDGAZR2VDUYy2Fi2wbwO3ZE8sSC9H8GECrTcpEmi0P8+OghUiTkGCAa8eUA649xNA8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705332940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dLHU4iQjZhPpcswtwarDaTQE+BEeTgfHRDHHLN8U7F4=; b=TCOIFlWsq0xdPMDPzicKtFpZS7690VWe/CdzECQOi+bUU0usCXdQfTOp16iiwPtjWmLGBQ 1BgfXm9g/jbe+z4UIVmlgVwwica/rJznI1U230QQNlsitzfhOkiIJjhWoQjKVzQQ6XukV/ ljTTRpjcPtcIDo4RUJzOPSCCpIvCEo4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-v76JVHYNOlaqJUcJsX8siw-1; Mon, 15 Jan 2024 10:35:38 -0500 X-MC-Unique: v76JVHYNOlaqJUcJsX8siw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 782A188F561; Mon, 15 Jan 2024 15:35:38 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FAE6492BC6; Mon, 15 Jan 2024 15:35:36 +0000 (UTC) From: Florian Weimer To: Carlos O'Donell Cc: Adhemerval Zanella Netto , Szabolcs Nagy , gcc@gcc.gnu.org, libc-alpha@sourceware.org, Iain Sandoe , aburgess@redhat.com, lttng-dev@lists.lttng.org Subject: Re: New TLS usage in libgcc_s.so.1, compatibility impact References: <8734v1ieke.fsf@oldenburg.str.redhat.com> <81279c5d-0b60-0e37-abe9-0936688b14fa@redhat.com> Date: Mon, 15 Jan 2024 16:35:34 +0100 In-Reply-To: <81279c5d-0b60-0e37-abe9-0936688b14fa@redhat.com> (Carlos O'Donell's message of "Mon, 15 Jan 2024 09:47:26 -0500") Message-ID: <87jzoa6249.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * 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