From patchwork Mon Jan 15 15:19:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 84128 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 669FF3858C62 for ; Mon, 15 Jan 2024 15:19:42 +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 D40493858D1E for ; Mon, 15 Jan 2024 15:19:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D40493858D1E 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 D40493858D1E 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=1705331957; cv=none; b=NtNiKpd99PFZGGgBkKyu97sCdI1ip63LK95/5UdtbFMe+dEiNcA7E3AOr0Yw7P8UsJq/RhlUdWr1yGX1a7Ztmb+twxt5pmSzs3NMgIo6xAC2L5C8d5b7q+FiU6bYpUst4Z1f2FFA/eds0vhosXZGvXXw/2M4tChhX4ntHxtvyEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705331957; c=relaxed/simple; bh=hJSF8s3BK0SKODvvZn8c9qOW+YLMrWKHvQzwIqkRG5s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uIexq5Gq+Ipx/Wr4ix7VNTqonukKBd+HVcGBK4IrxMP5EU/P9sACPGrdhB9Upzx/PDj7IMNdTNYAAGBmyjQsjnTe9UO4Y1SyRMGf5aMzJFy0d01NDyE7Sgo2dKNMYSY1SLb2hvdpmEDnrCFM0UCiebkbOL34ey28VMz5ovUHWrU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705331945; 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; bh=+iqi74QvotD62ho+0vwHT/acUOzwBNyboQbBfsdZMnQ=; b=CfRqqwy6z1eGY+Pqm5jDEMjmg3pMNMAah7wVJU7xHfcjM362aBUDpNKbLQ9ojdUKpjUq2j rXeDVc2lzGst8b+qrdm6VXJK6zhyRGkR+1alGcDoXMTo9LYDtgygtC+eP2nYmwFtTjweLh 64Rt/3GI1FPD/m4wxn34rJnUzBDwhDg= 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-682-cWE1tMF7OGSZ6ykLAj7z-A-1; Mon, 15 Jan 2024 10:19:04 -0500 X-MC-Unique: cWE1tMF7OGSZ6ykLAj7z-A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 2143A811E9C; Mon, 15 Jan 2024 15:19:04 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 905A940C6EB9; Mon, 15 Jan 2024 15:19:03 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Cc: Szabolcs Nagy Subject: [PATCH] manual, NEWS: Document malloc side effect of dynamic TLS changes Date: Mon, 15 Jan 2024 16:19:01 +0100 Message-ID: <87o7dm62vu.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.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 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]"). --- 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..4193b45e98 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} internal. 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