elf: fix pthread_create and dlopen racing

(cherry picked from commit c1ac1c53cbb62cd213db8b007347f464286cc84d)
This commit is contained in:
xujing 2021-12-02 15:54:56 +08:00 committed by openeuler-sync-bot
parent e8c884bd9c
commit 0d97c1aa48
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 4204b32bffc28772b7d026964f7ca325b00f7609 Mon Sep 17 00:00:00 2001
From: xujing <xujing99@huawei.com>
Date: Thu, 2 Dec 2021 11:53:30 +0800
Subject: [PATCH] fix pthread_create and dlopen racing.
reason: fix pthread_create and dlopen racing.
---
elf/dl-tls.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index c87caf13..1840f122 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -478,7 +478,8 @@ _dl_allocate_tls_init (void *result)
/* Keep track of the maximum generation number. This might
not be the generation counter. */
- assert (listp->slotinfo[cnt].gen <= GL(dl_tls_generation));
+ if (listp->slotinfo[cnt].gen > GL(dl_tls_generation))
+ _dl_printf("warning: listp->slotinfo[cnt].gen > GL(dl_tls_generation) !\n");
maxgen = MAX (maxgen, listp->slotinfo[cnt].gen);
dtv[map->l_tls_modid].pointer.val = TLS_DTV_UNALLOCATED;
@@ -514,7 +515,11 @@ _dl_allocate_tls_init (void *result)
break;
listp = listp->next;
- assert (listp != NULL);
+ if (listp == NULL)
+ {
+ _dl_printf("warning: listp == NULL !\n");
+ break;
+ }
}
/* The DTV version is up-to-date now. */
--
2.23.0

View File

@ -59,7 +59,7 @@
##############################################################################
Name: glibc
Version: 2.28
Release: 81
Release: 82
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -140,6 +140,7 @@ Patch56: backport-rtld-copy-terminating-null-in-tunables_strdup-bug-28.patch
Patch57: backport-gconv-Do-not-emit-spurious-NUL-character-in-ISO-2022.patch
Patch58: backport-nss-make-sure-startp_initialized-do-first.patch
Patch59: backport-glibc-fix-CVE-2019-1010023.patch
Patch60: backport-fix-pthread_create-and-dlopen-racing.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -1164,6 +1165,9 @@ fi
%doc hesiod/README.hesiod
%changelog
* Thu Dec 2 2021 xujing <xujing99@huawei.com> - 2.28-82
- elf: fix pthread_create and dlopen racing
* Thu Dec 2 2021 xujing <xujing99@huawei.com> - 2.28-81
- glibc: fix CVE-2019-1010023