From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 5D3A33858D38; Wed, 24 Jan 2024 08:34:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D3A33858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706085272; bh=rk/OBb+gcBTnFB2gIxMgMET3bXIxmtYiIqCrKRZa3mM=; h=From:To:Subject:Date:From; b=AOadTopThDszQHau2N3DHe7CuH4HCzBY5UJUQLvIEsF6YZLsBm8jGtxqplO7cQCrI mMoxQULLtoRX8KnZ+tjvv1kWB8sCnjWI+T5MdXaPA2jATdcrqbxNUEpd4c/wSeR4HN /TiyqONyxM/lBtHbbMBEvZoGxyhhc99tv1+06H6I= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] manual, NEWS: Document malloc side effect of dynamic TLS changes X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: aeb497d1feee3b50447c4b74d6934746597783ae X-Git-Newrev: 486452affbac684db739b7fcca1e84e8a7ce33d1 Message-Id: <20240124083432.5D3A33858D38@sourceware.org> Date: Wed, 24 Jan 2024 08:34:31 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=486452affbac684db739b7fcca1e84e8a7ce33d1 commit 486452affbac684db739b7fcca1e84e8a7ce33d1 Author: Florian Weimer Date: Wed Jan 24 09:34:15 2024 +0100 manual, NEWS: Document malloc side effect of dynamic TLS changes The increased malloc subsystem usage is a side effect of commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow tls access after dlopen [BZ #19924]"). Reviewed-by: Szabolcs Nagy Diff: --- NEWS | 6 ++++++ manual/memory.texi | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/NEWS b/NEWS index 4a11e9df0f..199f079f27 100644 --- a/NEWS +++ b/NEWS @@ -91,6 +91,12 @@ 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 + during TLS access if a shared object with dynamic TLS is loaded and + unloaded. This can result in an infinite recursion if a malloc + replacement library or its dependencies use 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