diff mbox series

malloc: Use initial-exec TLS in libmemusage

Message ID 87cynn2f3w.fsf@oldenburg.str.redhat.com
State New
Headers show
Series malloc: Use initial-exec TLS in libmemusage | expand

Commit Message

Florian Weimer July 9, 2024, 7:34 a.m. UTC
The start_sp variable is accessed from a signal handler, and
global-dynamic TLS is not necessarily async-signal-safe in the
current implementation.  This change also aligns libmemusage with
the recommendation to use initial-exec TLS in malloc
replacements.

---
 malloc/memusage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/malloc/memusage.c b/malloc/memusage.c
index e8ae80dc74..46c8434ae1 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -86,7 +86,7 @@  static _Atomic unsigned long int inplace_mremap;
 static _Atomic unsigned long int decreasing_mremap;
 static _Atomic size_t current_heap;
 static _Atomic size_t peak_use[3];
-static __thread uintptr_t start_sp;
+static __thread uintptr_t start_sp attribute_tls_model_ie;
 
 /* A few macros to make the source more readable.  */
 #define peak_heap       peak_use[0]