!180 upgrade to glibc2.34

From: @liqingqing_1229
Reviewed-by: @wswsamao,@wswsamao
Signed-off-by: @wswsamao
This commit is contained in:
openeuler-ci-bot 2021-08-06 12:12:11 +00:00 committed by Gitee
commit ac300bf2a3
9 changed files with 11 additions and 2719 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
From 5adda61f62b77384718b4c0d8336ade8f2b4b35c Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Fri, 25 Jun 2021 15:02:47 +0200
Subject: [PATCH] wordexp: handle overflow in positional parameter number (bug
28011)
Use strtoul instead of atoi so that overflow can be detected.
Conflict:NA
Reference:https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=5adda61f62b77384718b4c0d8336ade8f2b4b35c
---
posix/wordexp-test.c | 1 +
posix/wordexp.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index f93a546d7e..9df02dbbb3 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -183,6 +183,7 @@ struct test_case_struct
{ 0, NULL, "$var", 0, 0, { NULL, }, IFS },
{ 0, NULL, "\"\\n\"", 0, 1, { "\\n", }, IFS },
{ 0, NULL, "", 0, 0, { NULL, }, IFS },
+ { 0, NULL, "${1234567890123456789012}", 0, 0, { NULL, }, IFS },
/* Flags not already covered (testit() has special handling for these) */
{ 0, NULL, "one two", WRDE_DOOFFS, 2, { "one", "two", }, IFS },
diff --git a/posix/wordexp.c b/posix/wordexp.c
index bcbe96e48d..1f3b09f721 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1399,7 +1399,7 @@ envsubst:
/* Is it a numeric parameter? */
else if (isdigit (env[0]))
{
- int n = atoi (env);
+ unsigned long n = strtoul (env, NULL, 10);
if (n >= __libc_argc)
/* Substitute NULL. */
--
2.27.0

View File

@ -1,52 +0,0 @@
From 217b6dc298156bdb0d6aea9ea93e7e394a5ff091 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 1 Jun 2021 17:51:41 +0200
Subject: [PATCH] Fix use of __pthread_attr_copy in mq_notify (bug 27896)
__pthread_attr_copy can fail and does not initialize the attribute
structure in that case.
If __pthread_attr_copy is never called and there is no allocated
attribute, pthread_attr_destroy should not be called, otherwise
there is a null pointer dereference in rt/tst-mqueue6.
Fixes commit 42d359350510506b87101cf77202fefcbfc790cb
("Use __pthread_attr_copy in mq_notify (bug 27896)").
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
sysdeps/unix/sysv/linux/mq_notify.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index f7ddfe5a6c..6f46d29d1d 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -258,7 +258,14 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
if (data.attr == NULL)
return -1;
- __pthread_attr_copy (data.attr, notification->sigev_notify_attributes);
+ int ret = __pthread_attr_copy (data.attr,
+ notification->sigev_notify_attributes);
+ if (ret != 0)
+ {
+ free (data.attr);
+ __set_errno (ret);
+ return -1;
+ }
}
/* Construct the new request. */
@@ -271,7 +278,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
int retval = INLINE_SYSCALL (mq_notify, 2, mqdes, &se);
/* If it failed, free the allocated memory. */
- if (__glibc_unlikely (retval != 0))
+ if (retval != 0 && data.attr != NULL)
{
pthread_attr_destroy (data.attr);
free (data.attr);
--
2.27.0

View File

@ -1,69 +0,0 @@
From 42d359350510506b87101cf77202fefcbfc790cb Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Thu, 27 May 2021 12:49:47 +0200
Subject: [PATCH] Use __pthread_attr_copy in mq_notify (bug 27896)
Make a deep copy of the pthread attribute object to remove a potential
use-after-free issue.
---
NEWS | 3 +++
sysdeps/unix/sysv/linux/mq_notify.c | 15 ++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 71f5d20..9e5bcf4 100644
--- a/NEWS
+++ b/NEWS
@@ -101,6 +101,9 @@ Changes to build and runtime requirements:
* s390x requires GCC 7.1 or newer. See gcc Bug 98269.
Security related changes:
+ CVE-2021-33574: The mq_notify function has a potential use-after-free
+ issue when using a notification type of SIGEV_THREAD and a thread
+ attribute with a non-default affinity mask.
CVE-2021-3326: An assertion failure during conversion from the
ISO-20220-JP-3 character set using the iconv function has been fixed.
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index cc575a0..f7ddfe5 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -133,8 +133,11 @@ helper_thread (void *arg)
(void) __pthread_barrier_wait (&notify_barrier);
}
else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
- /* The only state we keep is the copy of the thread attributes. */
- free (data.attr);
+ {
+ /* The only state we keep is the copy of the thread attributes. */
+ pthread_attr_destroy (data.attr);
+ free (data.attr);
+ }
}
return NULL;
}
@@ -255,8 +258,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
if (data.attr == NULL)
return -1;
- memcpy (data.attr, notification->sigev_notify_attributes,
- sizeof (pthread_attr_t));
+ __pthread_attr_copy (data.attr, notification->sigev_notify_attributes);
}
/* Construct the new request. */
@@ -270,7 +272,10 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
/* If it failed, free the allocated memory. */
if (__glibc_unlikely (retval != 0))
- free (data.attr);
+ {
+ pthread_attr_destroy (data.attr);
+ free (data.attr);
+ }
return retval;
}
--
1.8.3.1

View File

@ -1,42 +0,0 @@
From dfec225ee1972488bb48a8b67a2c4a13010c334a Mon Sep 17 00:00:00 2001
From: JeffyChen <jeffy.chen@rock-chips.com>
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 <dj@redhat.com>
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

View File

@ -1,65 +0,0 @@
From a4efbf44757477717a907078c340386146c7623f Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Wed, 3 Feb 2021 15:36:47 -0300
Subject: [PATCH] posix/tst-rfc3484: Fix compile failure linking to local
__stat64
After 04986243d1 ("Remove internal usage of extensible stat functions")
linking the __stat64 symbol in getaddrinfo for this test fails with the
below error:
[...] or1k-smh-linux-gnu/bin/ld: [...]/posix/tst-rfc3484.o: in function `gaiconf_reload':
[...]/sysdeps/posix/getaddrinfo.c:2136: undefined reference to `__stat64'
collect2: error: ld returned 1 exit status
This is because __stat64 is a local symbol, the test includes the
getaddrinfo directly and fails to link against the local symbol. Fix
this by setting up an alias to the global stat64 symbol name like is
done for other local symbol usage.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
posix/tst-rfc3484-2.c | 1 +
posix/tst-rfc3484-3.c | 1 +
posix/tst-rfc3484.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
index 5f5ada9420..ce8ccd5f38 100644
--- a/posix/tst-rfc3484-2.c
+++ b/posix/tst-rfc3484-2.c
@@ -11,6 +11,7 @@
#define __gethostbyaddr_r gethostbyaddr_r
#define __gethostbyname2_r gethostbyname2_r
#define __qsort_r qsort_r
+#define __stat64 stat64
void
attribute_hidden
diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
index d9ec5cc851..ecb163963f 100644
--- a/posix/tst-rfc3484-3.c
+++ b/posix/tst-rfc3484-3.c
@@ -11,6 +11,7 @@
#define __gethostbyaddr_r gethostbyaddr_r
#define __gethostbyname2_r gethostbyname2_r
#define __qsort_r qsort_r
+#define __stat64 stat64
void
attribute_hidden
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index 97d065b6bf..3b2052eb54 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -11,6 +11,7 @@
#define __gethostbyaddr_r gethostbyaddr_r
#define __gethostbyname2_r gethostbyname2_r
#define __qsort_r qsort_r
+#define __stat64 stat64
void
attribute_hidden
--
2.23.0

View File

@ -59,8 +59,8 @@
# glibc - The GNU C Library (glibc) core package.
##############################################################################
Name: glibc
Version: 2.33
Release: 7
Version: 2.34
Release: 1
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -76,18 +76,10 @@ Source7: replace_same_file_to_hard_link.py
Patch0: glibc-1070416.patch
Patch1: glibc-c-utf8-locale.patch
Patch2: Fix-the-inaccuracy-of-j0f-j1f-y0f-y1f-BZ.patch
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
#Patch9000: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch
Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
Patch9002: build-extra-libpthreadcond-so.patch
Patch9003: remove-country-selection-from-tzselect.patch
#Patch9002: build-extra-libpthreadcond-so.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -478,7 +470,7 @@ for d in $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT/%{_lib}; do
done
%endif
make -j1 install_root=$RPM_BUILD_ROOT install -C build-%{target}
make %{?_smp_mflags} install_root=$RPM_BUILD_ROOT install -C build-%{target}
%if %{with libpthreadcond}
cp build-%{target}/nptl/libpthreadcond.so $RPM_BUILD_ROOT%{_libdir}
@ -621,13 +613,10 @@ mv -f $RPM_BUILD_ROOT/%{_lib}/lib{pcprofile,memusage}.so \
# Strip all of the installed object files.
strip -g $RPM_BUILD_ROOT%{_libdir}/*.o
# Rebuild libpthread.a using --whole-archive to ensure all of libpthread
# is included in a static link.
# create a null libpthread static link for compatibility.
pushd $RPM_BUILD_ROOT%{_prefix}/%{_lib}/
%GCC -r -nostdlib -o libpthread.o -Wl,--whole-archive ./libpthread.a
rm libpthread.a
ar rcs libpthread.a libpthread.o
rm libpthread.o
ar rc libpthread.a
popd
for i in $RPM_BUILD_ROOT%{_prefix}/bin/{xtrace,memusage}; do
@ -778,7 +767,7 @@ grep '/libnss_[a-z]*\.so$' master.filelist > nss-devel.filelist
##############################################################################
# libnsl subpackage
##############################################################################
grep '/libnsl-[0-9.]*.so$' master.filelist > libnsl.filelist
grep -E '/libnsl\.so\.[0-9]+$' master.filelist > libnsl.filelist
test $(wc -l < libnsl.filelist) -eq 1
##############################################################################
@ -1174,6 +1163,9 @@ fi
%doc hesiod/README.hesiod
%changelog
* Thu Aug 5 2021 Qingqing Li<liqingqing3@huawei.com> - 2.34-1
- upgrade to 2.34.
* Fri Jul 23 2021 zhouwenpei<zhouwenpei1@huawei.com> - 2.33-7
- remove unnecessary build require.

View File

@ -1,151 +0,0 @@
From dff0000cc458d6d4993b821f2badcf31ea28062e Mon Sep 17 00:00:00 2001
From: MarsChan <cmm8293@163.com>
Date: Sun, 6 Sep 2020 09:42:44 +0800
Subject: [PATCH] remove country selection from tzselect.ksh
---
timezone/tzselect.ksh | 98 +++++++++----------------------------------
1 file changed, 20 insertions(+), 78 deletions(-)
diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh
index 18fce27e..7e31798c 100755
--- a/timezone/tzselect.ksh
+++ b/timezone/tzselect.ksh
@@ -51,7 +51,7 @@ say() {
coord=
location_limit=10
-zonetabtype=zone1970
+zonetabtype=zone
usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT]
Select a timezone interactively.
@@ -398,94 +398,37 @@ while
'`
;;
*)
- # Get list of names of countries in the continent or ocean.
- countries=`$AWK \
+ # Get list of regions in the continent or ocean.
+ timezones=`$AWK \
-v continent="$continent" \
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
'
BEGIN { FS = "\t" }
/^#/ { next }
$3 ~ ("^" continent "/") {
- ncc = split($1, cc, /,/)
+ ncc = split($3, cc, /,/)
for (i = 1; i <= ncc; i++)
if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i]
}
END {
- while (getline <TZ_COUNTRY_TABLE) {
- if ($0 !~ /^#/) cc_name[$1] = $2
- }
for (i = 1; i <= ccs; i++) {
- country = cc_list[i]
- if (cc_name[country]) {
- country = cc_name[country]
- }
- print country
+ print cc_list[i]
}
}
' <"$TZ_ZONE_TABLE" | sort -f`
-
-
- # If there's more than one country, ask the user which one.
- case $countries in
- *"$newline"*)
- echo >&2 'Please select a country' \
- 'whose clocks agree with yours.'
- doselect $countries
- country=$select_result;;
- *)
- country=$countries
- esac
-
-
- # Get list of timezones in the country.
- regions=`$AWK \
- -v country="$country" \
- -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
- '
- BEGIN {
- FS = "\t"
- cc = country
- while (getline <TZ_COUNTRY_TABLE) {
- if ($0 !~ /^#/ && country == $2) {
- cc = $1
- break
- }
- }
- }
- /^#/ { next }
- $1 ~ cc { print $4 }
- ' <"$TZ_ZONE_TABLE"`
-
-
- # If there's more than one region, ask the user which one.
- case $regions in
- *"$newline"*)
- echo >&2 'Please select one of the following timezones.'
- doselect $regions
- region=$select_result;;
- *)
- region=$regions
- esac
+ regions=[]
+ index=0
+ for item in $timezones; do
+ regions[$index]=`echo $item | awk -F '/' '{print $2}'`
+ index=$(($index+1))
+ done
+ echo >&2 'Please select a timezone' \
+ 'whose clocks agree with yours.'
+ doselect ${regions[@]}
+ region=$select_result
# Determine TZ from country and region.
- TZ=`$AWK \
- -v country="$country" \
- -v region="$region" \
- -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
- '
- BEGIN {
- FS = "\t"
- cc = country
- while (getline <TZ_COUNTRY_TABLE) {
- if ($0 !~ /^#/ && country == $2) {
- cc = $1
- break
- }
- }
- }
- /^#/ { next }
- $1 ~ cc && $4 == region { print $3 }
- ' <"$TZ_ZONE_TABLE"`
+ TZ=$continent/$region
esac
# Make sure the corresponding zoneinfo file exists.
@@ -523,11 +466,10 @@ Universal Time is now: $UTdate."
echo >&2 ""
echo >&2 "The following information has been given:"
echo >&2 ""
- case $country%$region%$coord in
- ?*%?*%) say >&2 " $country$newline $region";;
- ?*%%) say >&2 " $country";;
- %?*%?*) say >&2 " coord $coord$newline $region";;
- %%?*) say >&2 " coord $coord";;
+ case $region%$coord in
+ ?*%) say >&2 " $region";;
+ ?*%?*) say >&2 " coord $coord$newline $region";;
+ %?*) say >&2 " coord $coord";;
*) say >&2 " TZ='$TZ'"
esac
say >&2 ""
--
2.24.3 (Apple Git-128)