diff --git a/backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch b/backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e260b1367ebb590d22338cba5426bb24739c2b6 --- /dev/null +++ b/backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch @@ -0,0 +1,42 @@ +From dfec225ee1972488bb48a8b67a2c4a13010c334a Mon Sep 17 00:00:00 2001 +From: JeffyChen +Date: Fri, 2 Jul 2021 17:39:24 +0200 +Subject: [PATCH] malloc: Initiate tcache shutdown even without allocations [BZ + #28028] + +After commit 1e26d35193efbb29239c710a4c46a64708643320 ("malloc: Fix +tcache leak after thread destruction [BZ #22111]"), +tcache_shutting_down is still not early enough. When we detach a +thread with no tcache allocated, tcache_shutting_down would still be +false. + +Reviewed-by: DJ Delorie + +Conflict:NA +Reference:https://sourceware.org/git/?p=glibc.git;a=commit;h=dfec225ee1972488bb48a8b67a2c4a13010c334a +--- + malloc/malloc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/malloc/malloc.c b/malloc/malloc.c +index 0e2e1747e0..bb9a1642aa 100644 +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -3144,12 +3144,13 @@ tcache_thread_shutdown (void) + int i; + tcache_perthread_struct *tcache_tmp = tcache; + ++ tcache_shutting_down = true; ++ + if (!tcache) + return; + + /* Disable the tcache and prevent it from being reinitialized. */ + tcache = NULL; +- tcache_shutting_down = true; + + /* Free all of the entries and the tcache itself back to the arena + heap for coalescing. */ +-- +2.27.0 + diff --git a/glibc.spec b/glibc.spec index aafaf75528b346374e5f4983026ebb6846d68270..7825f39b7090af8935e37d71c20b84a40ddca972 100644 --- a/glibc.spec +++ b/glibc.spec @@ -60,7 +60,7 @@ ############################################################################## Name: glibc Version: 2.33 -Release: 5 +Release: 6 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -82,6 +82,7 @@ Patch6000: backport-posix-tst-rfc3484-Fix-compile-failure-linking-to-loc.patch Patch6001: backport-Use-__pthread_attr_copy-in-mq_notify-bug-27896.patch Patch6002: backport-Fix-use-of-__pthread_attr_copy-in-mq_notify-bug-27896.patch Patch6003: backport-CVE-2021-35942-wordexp-handle-overflow-in-positional-parameter-numb.patch +Patch6004: backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch Patch9000: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch @@ -1173,7 +1174,11 @@ fi %doc hesiod/README.hesiod %changelog -* Thu Jul 1 2021 QingqingLi - 2.33-5 +* Sat Jul 3 2021 Qingqing Li - 2.33-6 +- malloc: tcache shutdown sequence does not work if the thread never allocated anything. (bug 28028) + https://sourceware.org/bugzilla/show_bug.cgi?id=28028 + +* Thu Jul 1 2021 Qingqing Li - 2.33-5 - wordexp: Use strtoul instead of atoi so that overflow can be detected. (bug 28011) https://sourceware.org/bugzilla/show_bug.cgi?id=28011