[PATCH v4 1/7] malloc: missing initialization of tcache in _mid_memalign

Cupertino Miranda cupertino.miranda@oracle.com
Fri Mar 14 17:29:20 GMT 2025


_mid_memalign includes tcache code but does not attempt to initialize
tcaches.
This patch fixes the following regressions in this patch series:
  FAIL: malloc/tst-malloc-thread-fail
  FAIL: malloc/tst-malloc-thread-fail-malloc-hugetlb1
  FAIL: malloc/tst-malloc-thread-fail-malloc-hugetlb2
---
 malloc/malloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 27dfd1eb90..2ae308f3ae 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3692,6 +3692,8 @@ _mid_memalign (size_t alignment, size_t bytes, void *address)
       }
     size_t tc_idx = csize2tidx (tbytes);
 
+    MAYBE_INIT_TCACHE ();
+
     if (tcache_available (tc_idx))
       {
 	/* The tcache itself isn't encoded, but the chain is.  */
-- 
2.39.5



More information about the Libc-alpha mailing list