From patchwork Mon Jan 15 19:19:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 84139 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0118A385E451 for ; Mon, 15 Jan 2024 19:20:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 9B414385E446 for ; Mon, 15 Jan 2024 19:19:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B414385E446 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 9B414385E446 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705346379; cv=none; b=Z3C356GYD+YYTDuyW+137O1LLVY0C/+QjPH/gqXlbDkQHR+1milZNpvvfh34DuUJhGTTvB/Gmmm3w1+xGgCImiRDW61dMVTlQQcd2th/B4FALFWgaGwU2HFx9zVFHL25V7TJANcLCMPkg5juubROR+dgyB4c6kvGryVqNIm4PG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705346379; c=relaxed/simple; bh=xddv2nbNHQz4HAPhVraXuITSh0FJDggv2YRZ49KgmrY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FSL8Wn/LihImS/LDsUnbWGlZXbhCDnHJXh5XPlVr1m5mT4h2G99ydjA0RZiLhIbBIZpDGlTlwj93tDu2nJLS9Irr6o0iPpJNauPg99Aq9nNQzrafIQP4f5nL464GsvdXEXChG++ExUH+cGccqE0+tfOJfwd5Ng2N5nGgPlamLuk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705346376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=QRU511btN5DaawMYuVLeeRn4F9cfHIscRil5A58mpek=; b=SfWcrvODspcaTuBiz50Jz2+txiT9BvdihhIQO/E4buitBG4JRacNAxeZ1XyrsVQj3JysFz eGgj82DzWpFBuCnzaCL2wR4K/xySHHnlneAiHQUDdZTWx2tfFO+Q9chEXKT0gW1szbY2Vb OQh/BL4Fvrvg5LXySRpmVeXwK22S8G4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-obuopMQ_P6afnsoilgnQkA-1; Mon, 15 Jan 2024 14:19:35 -0500 X-MC-Unique: obuopMQ_P6afnsoilgnQkA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 DE41C3C025BA for ; Mon, 15 Jan 2024 19:19:34 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75EA51C060B2 for ; Mon, 15 Jan 2024 19:19:34 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH v2] manual, NEWS: Document malloc side effect of dynamic TLS changes Date: Mon, 15 Jan 2024 20:19:33 +0100 Message-ID: <87y1cq4d6i.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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org The increased malloc subsystem usage is a side effect of commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow tls access after dlopen [BZ #19924]"). Reviewed-by: DJ Delorie --- NEWS | 5 +++++ manual/memory.texi | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 1da3a6e6ee..a87271e573 100644 --- a/NEWS +++ b/NEWS @@ -80,6 +80,11 @@ Deprecated and removed features, and other changes affecting compatibility: of GNU libc are advised to check whether their build processes can be simplified. +* The dynamic linker calls the malloc and free functions in more cases + if a shared object with dynamic TLS is loaded and unloaded. This can + result in an infinite recursion if a malloc replacement libraries or + its dependencies uses dynamic TLS instead of initial-exec TLS. + * The ia64*-*-linux-gnu configurations are no longer supported. Changes to build and runtime requirements: diff --git a/manual/memory.texi b/manual/memory.texi index 258fdbd3a0..fb875f4c3c 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -1815,6 +1815,14 @@ using shared object dependencies or @code{LD_PRELOAD}. For static linking, the @code{malloc} replacement library must be linked in before linking against @code{libc.a} (explicitly or implicitly). +Care must be taken not to use functionality from @theglibc{} that uses +@code{malloc} internally. For example, the @code{fopen}, +@code{opendir}, @code{dlopen}, and @code{pthread_setspecific} functions +currently use the @code{malloc} subsystem internally. If the +replacement @code{malloc} or its dependencies use thread-local storage +(TLS), it must use the initial-exec TLS model, and not one of the +dynamic TLS variants. + @strong{Note:} Failure to provide a complete set of replacement functions (that is, all the functions used by the application, @theglibc{}, and other linked-in libraries) can lead to static linking