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 a7b42219b4db4e0bd4a3e7ed4f9d97d8ac220300..116765c78c1c13a1c8d83243d57f16fc691cd5b0 100644 --- a/glibc.spec +++ b/glibc.spec @@ -59,7 +59,7 @@ ############################################################################## Name: glibc Version: 2.28 -Release: 72 +Release: 73 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -130,6 +130,7 @@ Patch46: backport-aarch64-align-stack-in-clone-BZ-27939.patch Patch47: backport-x86-64-Align-child-stack-to-16-bytes-BZ-27902.patch Patch48: backport-ldconfig-handle-.dynstr-located-in-separate-segment-.patch Patch49: backport-CVE-2021-35942-wordexp-handle-overflow-in-positional-parameter-numb.patch +Patch50: backport-malloc-Initiate-tcache-shutdown-even-without-allocat.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1154,7 +1155,11 @@ fi %doc hesiod/README.hesiod %changelog -* Thu Jul 1 2021 QingqingLi - 2.28-72 +* Sat Jul 3 2021 Qingqing Li - 2.28-73 +- 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.28-72 - wordexp: Use strtoul instead of atoi so that overflow can be detected. (bug 28011) https://sourceware.org/bugzilla/show_bug.cgi?id=28011