Accepting request 951353 from home:Andreas_Schwab:Factory

- Update to glibc 2.35
  Major new features:
  * Unicode 14.0.0 Support
  * Bump r_version in the debugger interface to 2
  * Support for the C.UTF-8 locale has been added to glibc
  * <math.h> functions that round their results to a narrower type, and
    corresponding <tgmath.h> macros, are added from TS 18661-1:2014, TS
    18661-3:2015 and draft ISO C2X
  * <math.h> functions for floating-point maximum and minimum,
    corresponding to new operations in IEEE 754-2019, and corresponding
    <tgmath.h> macros, are added from draft ISO C2X
  * <math.h> macros for single-precision float constants are added as a
    GNU extension
  * The __STDC_IEC_60559_BFP__ and __STDC_IEC_60559_COMPLEX__ macros are
    predefined as specified in TS 18661-1:2014
  * The exp10 functions in <math.h> now have a corresponding type-generic
    macro in <tgmath.h>
  * The ISO C2X macro _PRINTF_NAN_LEN_MAX has been added to <stdio.h>
  * printf-family functions now support the %b format for output of
    integers in binary, as specified in draft ISO C2X, and the %B variant
    of that format recommended by draft ISO C2X
  * A new DSO sorting algorithm has been added in the dynamic linker that uses
    topological sorting by depth-first search (DFS), solving performance issues
    of the existing sorting algorithm when encountering particular circular
    object dependency cases
  * A new tunable, glibc.rtld.dynamic_sort, can be used to select between
    the two DSO sorting algorithms
  * ABI support for a new function '__memcmpeq'. '__memcmpeq' is meant
    to be used by compilers for optimizing usage of 'memcmp' when its
    return value is only used for its boolean status

OBS-URL: https://build.opensuse.org/request/show/951353
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=610
This commit is contained in:
Andreas Schwab 2022-02-03 16:39:47 +00:00 committed by Git OBS Bridge
parent a8d047aa30
commit 3955683696
27 changed files with 149 additions and 2185 deletions

View File

@ -1,28 +0,0 @@
From 45caed9d67a00af917d8b5b88d4b5eb1225b7aef Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:53 +0530
Subject: [PATCH] copy_and_spawn_sgid: Avoid double calls to close()
If close() on infd and outfd succeeded, reset the fd numbers so that
we don't attempt to close them again.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
---
support/support_capture_subprocess.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
index 27bfd19c93..0bacf6dbc2 100644
--- a/support/support_capture_subprocess.c
+++ b/support/support_capture_subprocess.c
@@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
support_subprogram because we only want the program exit status, not the
contents. */
ret = 0;
+ infd = outfd = -1;
char * const args[] = {execname, child_id, NULL};
--
2.32.0

View File

@ -1,72 +0,0 @@
From c87fcacc50505d550f1bb038382bcc7ea73a5926 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 6 Aug 2021 09:51:38 +0200
Subject: [PATCH] Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64
(bug 28182)
__REDIRECT and __THROW are not compatible with C++ due to the ordering of the
__asm__ alias and the throw specifier. __REDIRECT_NTH has to be used
instead.
Fixes commit 8a40aff86ba5f64a3a84883e539cb67b ("io: Add time64 alias
for fcntl"), commit 82c395d91ea4f69120d453aeec398e30 ("misc: Add
time64 alias for ioctl"), commit b39ffab860cd743a82c91946619f1b8158
("Linux: Add time64 alias for prctl").
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
---
io/fcntl.h | 8 ++++----
misc/sys/ioctl.h | 4 ++--
sysdeps/unix/sysv/linux/sys/prctl.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/io/fcntl.h b/io/fcntl.h
index 8917a73b42..1c96f98f4d 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -187,10 +187,10 @@ extern int fcntl64 (int __fd, int __cmd, ...);
# endif
#else /* __USE_TIME_BITS64 */
# ifdef __REDIRECT
-extern int __REDIRECT (fcntl, (int __fd, int __request, ...),
- __fcntl_time64) __THROW;
-extern int __REDIRECT (fcntl64, (int __fd, int __request, ...),
- __fcntl_time64) __THROW;
+extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
+ __fcntl_time64);
+extern int __REDIRECT_NTH (fcntl64, (int __fd, int __request, ...),
+ __fcntl_time64);
# else
extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
# define fcntl64 __fcntl_time64
diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h
index 6884d9925f..9945c1e918 100644
--- a/misc/sys/ioctl.h
+++ b/misc/sys/ioctl.h
@@ -42,8 +42,8 @@ __BEGIN_DECLS
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
#else
# ifdef __REDIRECT
-extern int __REDIRECT (ioctl, (int __fd, unsigned long int __request, ...),
- __ioctl_time64) __THROW;
+extern int __REDIRECT_NTH (ioctl, (int __fd, unsigned long int __request, ...),
+ __ioctl_time64);
# else
extern int __ioctl_time64 (int __fd, unsigned long int __request, ...) __THROW;
# define ioctl __ioctl_time64
diff --git a/sysdeps/unix/sysv/linux/sys/prctl.h b/sysdeps/unix/sysv/linux/sys/prctl.h
index db88938b3a..f0e0d2f27f 100644
--- a/sysdeps/unix/sysv/linux/sys/prctl.h
+++ b/sysdeps/unix/sysv/linux/sys/prctl.h
@@ -42,7 +42,7 @@ __BEGIN_DECLS
extern int prctl (int __option, ...) __THROW;
#else
# ifdef __REDIRECT
-extern int __REDIRECT (prctl, (int __option, ...), __prctl_time64) __THROW;
+extern int __REDIRECT_NTH (prctl, (int __option, ...), __prctl_time64);
# else
extern int __prctl_time64 (int __option,d ...) __THROW;
# define ioctl __prctl_time64
--
2.32.0

View File

@ -143,10 +143,9 @@ Index: glibc-2.32/sysdeps/pthread/tst-stdio1.c
===================================================================
--- glibc-2.32.orig/sysdeps/pthread/tst-stdio1.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
@@ -1,55 +0,0 @@
-/* Copyright (C) 2002-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public

View File

@ -1,36 +0,0 @@
From 77a34079d8f3d63b61543bf3af93043f8674e4c4 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:11:03 +0530
Subject: [PATCH] gaiconf_init: Avoid double-free in label and precedence lists
labellist and precedencelist could get freed a second time if there
are allocation failures, so set them to NULL to avoid a double-free.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
---
sysdeps/posix/getaddrinfo.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 838a68f022..43dfc6739e 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2008,6 +2008,7 @@ gaiconf_init (void)
l = l->next;
}
free_prefixlist (labellist);
+ labellist = NULL;
/* Sort the entries so that the most specific ones are at
the beginning. */
@@ -2046,6 +2047,7 @@ gaiconf_init (void)
l = l->next;
}
free_prefixlist (precedencelist);
+ precedencelist = NULL;
/* Sort the entries so that the most specific ones are at
the beginning. */
--
2.32.0

View File

@ -1,37 +0,0 @@
From 5f9b78fe35d08739b6da1e5b356786d41116c108 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:20 +0530
Subject: [PATCH] gconv_parseconfdir: Fix memory leak
The allocated `conf` would leak if we have to skip over the file due
to the underlying filesystem not supporting dt_type.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
---
iconv/gconv_parseconfdir.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
index a4153e54c6..2f062689ec 100644
--- a/iconv/gconv_parseconfdir.h
+++ b/iconv/gconv_parseconfdir.h
@@ -153,12 +153,11 @@ gconv_parseconfdir (const char *dir, size_t dir_len)
struct stat64 st;
if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
continue;
- if (ent->d_type == DT_UNKNOWN
- && (lstat64 (conf, &st) == -1
- || !S_ISREG (st.st_mode)))
- continue;
- found |= read_conf_file (conf, dir, dir_len);
+ if (ent->d_type != DT_UNKNOWN
+ || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode)))
+ found |= read_conf_file (conf, dir, dir_len);
+
free (conf);
}
}
--
2.32.0

View File

@ -1,50 +0,0 @@
From 433ec4f14a5753c7689c83c20c9972915c53c204 Mon Sep 17 00:00:00 2001
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri, 10 Sep 2021 19:39:35 +0200
Subject: [PATCH] posix: Fix attribute access mode on getcwd [BZ #27476]
There is a GNU extension that allows to call getcwd(NULL, >0). It is
described in the documentation, but also directly in the unistd.h
header, just above the declaration.
Therefore the attribute access mode added in commit 06febd8c6705
is not correct. Drop it.
---
posix/bits/unistd.h | 5 ++---
posix/unistd.h | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index f0831386c7..622adeb2b2 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -199,10 +199,9 @@ __NTH (readlinkat (int __fd, const char *__restrict __path,
#endif
extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
- __THROW __wur __attr_access ((__write_only__, 1, 2));
+ __THROW __wur;
extern char *__REDIRECT_NTH (__getcwd_alias,
- (char *__buf, size_t __size), getcwd)
- __wur __attr_access ((__write_only__, 1, 2));
+ (char *__buf, size_t __size), getcwd) __wur;
extern char *__REDIRECT_NTH (__getcwd_chk_warn,
(char *__buf, size_t __size, size_t __buflen),
__getcwd_chk)
diff --git a/posix/unistd.h b/posix/unistd.h
index 3dca65732f..8224c5fbc9 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -528,8 +528,7 @@ extern int fchdir (int __fd) __THROW __wur;
an array is allocated with `malloc'; the array is SIZE
bytes long, unless SIZE == 0, in which case it is as
big as necessary. */
-extern char *getcwd (char *__buf, size_t __size) __THROW __wur
- __attr_access ((__write_only__, 1, 2));
+extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
#ifdef __USE_GNU
/* Return a malloc'd string containing the current directory name.
--
2.33.0

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:44d26a1fe20b8853a48f470ead01e4279e869ac149b195dda4e44a195d981ab2
size 17301232

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEcnNUKzmWLfeymZMUFnkrTqJTQPgFAmEHYusACgkQFnkrTqJT
QPjoWA//RsX2/6ZMZYfLgE9qFeDqhYZUMQje5L3/5BRHmWKSug5JOAodQv/6/r/a
SEA9vBwjJXcciE7ZspP8iNtuNpOu0OAvPemnCuUbw77q57h8LX+dDHs5BS9Km4CL
NWI0vUuI8P1ulXX5BELXWx5uUTz6SSmWh+VmpQ+/CZ4VXkrVp1YIaD6ZrzIUbvVC
yGOY1cRiT2kjc/E+FEI0YCSqmUqvf/dqPZaeM4H9z2RJW5eddOr0ruHJeEhjschV
XVqcMJ75UzuWQJjm/nrq3dWRm+ZAkMhXnm695zv9OD+BzXUvNrGxtM3838bFPFQw
WYXFnrNXSoHV5SCn8xTvJvhjw4uTo7HrA8QJOOvE9lKgyon3NdBgo6graZEWQYiF
dn2OYX0zj+bArj16+XlJ2jk1e+IkwDZdenQDuJjucR4e6uwnKUcuaAwtqKxL6MBq
1PYjINL7XFNsDwk9OZLjTCYIQsB3tHS9g3GsVhsX5fZGxa5ZzzyP69kaBMGjsQ4m
s/aYn0NWpv8MdUe/Nq0lUbMiChp3IIyIG0Zy14NihUH1tirj7odCxmG3qjR5DgUE
kCWJ5oSNJdrOE1vf3T2mIoN32epYGMedkNbWUtCqJc3LHe21dvPc7sdBUXgl0oJX
1X2axqrehtrhsfTyzvEfaoMNJfgtQoXEgkJyS3b1zdee3S/O5fA=
=/JWM
-----END PGP SIGNATURE-----

3
glibc-2.35.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5123732f6b67ccd319305efd399971d58592122bcc2a6518a1bd2510dd0cf52e
size 18165952

16
glibc-2.35.tar.xz.sig Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEcnNUKzmWLfeymZMUFnkrTqJTQPgFAmH7d7IACgkQFnkrTqJT
QPgoHBAAlQTCY/HD1Hpro1NaUT8nS0zzB1gw13soniPMdBtJvDTOVZhWkOSto1wg
9z5Tr/JmmnYCE6iu8npYRjkFRXTkPu+mazNcVvwTg08bb0LVn0q4IYHCkrJTLfZi
44fiG76SZOkh/+OTvqNfilWX62zJc1SeMIUy4O1OaPfBA4eZ4hjplOSjJLXG3Hu7
SZAp7yrTjz4qKJ0rWhGqqfGI7OsT34q3bnAWBRtzPFz+OesLgsLthOAik9vyuuTq
KnBumMmGforja2YToNDa1dkRi7iggDRrUrfi0fBraGXNUMab/QcwifV6gt+bQ/gH
CCalirxD1AQZnRQ/3aVAHE3L2u9fZzGIqbGpkCLhY6M35DKQoZTcW9nR3HfHcnZS
jpiPTu+ONiL0DTdqGAssgfYqP3cIQFEaX7XOpN6qldpuK2d8oJ6JbihIbT6yX/fn
3DYvFbJYSVCW+DN9FL1eMHHVP3R2YPoQ6FS5Iud0W6/p9NGPNYLoFrceZD08yms+
0HrxYiAb8YDgqk7M5eMSXdcaz2+uRCSTjZHZeGKhJK/5/x7LYAoCgvad5oy+K2pR
fdGxIUfVzJ3LrZRk6/7EbaQGYW07gV3uA0aRfdGQ3UL3xBHhQHEnnRDVpRHHsdSI
1mEj5jT7EEBJwEyppTZXOdTFHeV3ZPeC52rwLO0tQDku9Dn4R8U=
=vosd
-----END PGP SIGNATURE-----

View File

@ -1,266 +0,0 @@
From 2eda7b462b415105f5a05c1323372d4e39d46439 Mon Sep 17 00:00:00 2001
From: Mike FABIAN <mfabian@redhat.com>
Date: Mon, 10 Aug 2015 15:58:12 +0200
Subject: [PATCH] Add a C.UTF-8 locale
---
localedata/SUPPORTED | 1 +
localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 239 insertions(+)
create mode 100644 localedata/locales/C
Index: glibc-2.27/localedata/SUPPORTED
===================================================================
--- glibc-2.27.orig/localedata/SUPPORTED
+++ glibc-2.27/localedata/SUPPORTED
@@ -1,6 +1,7 @@
# This file names the currently supported and somewhat tested locales.
# If you have any additions please file a glibc bug report.
SUPPORTED-LOCALES=\
+C.UTF-8/UTF-8 \
aa_DJ.UTF-8/UTF-8 \
aa_DJ/ISO-8859-1 \
aa_ER/UTF-8 \
Index: glibc-2.27/localedata/locales/C
===================================================================
--- /dev/null
+++ glibc-2.27/localedata/locales/C
@@ -0,0 +1,238 @@
+escape_char /
+comment_char %
+% Locale for C locale in UTF-8
+
+LC_IDENTIFICATION
+title "C locale"
+source ""
+address ""
+contact ""
+email "mfabian@redhat.com"
+tel ""
+fax ""
+language "C"
+territory ""
+revision "1.0"
+date "2015-08-10"
+%
+category "i18n:2012";LC_IDENTIFICATION
+category "i18n:2012";LC_CTYPE
+category "i18n:2012";LC_COLLATE
+category "i18n:2012";LC_TIME
+category "i18n:2012";LC_NUMERIC
+category "i18n:2012";LC_MONETARY
+category "i18n:2012";LC_MESSAGES
+category "i18n:2012";LC_PAPER
+category "i18n:2012";LC_NAME
+category "i18n:2012";LC_ADDRESS
+category "i18n:2012";LC_TELEPHONE
+category "i18n:2012";LC_MEASUREMENT
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+
+END LC_CTYPE
+
+LC_COLLATE
+order_start forward
+<U0000>
+..
+<UFFFF>
+<U10000>
+..
+<U1FFFF>
+<U20000>
+..
+<U2FFFF>
+<UE0000>
+..
+<UEFFFF>
+<UF0000>
+..
+<UFFFFF>
+<U100000>
+..
+<U10FFFF>
+UNDEFINED
+order_end
+END LC_COLLATE
+
+LC_MONETARY
+% This is the 14652 i18n fdcc-set definition for
+% the LC_MONETARY category
+% (except for the int_curr_symbol and currency_symbol, they are empty in
+% the 14652 i18n fdcc-set definition and also empty in
+% glibc/locale/C-monetary.c. But localedef complains in that case).
+%
+% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
+% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
+int_curr_symbol "<U0055><U0053><U0044><U0020>"
+% Using "$" for currency_symbol. But maybe <U00A4> would be better?
+% U+00A4 is the "generic currency symbol"
+% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
+currency_symbol "<U0024>"
+mon_decimal_point "<U002E>"
+mon_thousands_sep ""
+mon_grouping -1
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits -1
+frac_digits -1
+p_cs_precedes -1
+int_p_sep_by_space -1
+p_sep_by_space -1
+n_cs_precedes -1
+int_n_sep_by_space -1
+n_sep_by_space -1
+p_sign_posn -1
+n_sign_posn -1
+%
+END LC_MONETARY
+
+LC_NUMERIC
+% This is the POSIX Locale definition for
+% the LC_NUMERIC category.
+%
+decimal_point "<U002E>"
+thousands_sep ""
+grouping -1
+END LC_NUMERIC
+
+LC_TIME
+% This is the POSIX Locale definition for
+% the LC_TIME category.
+%
+% Abbreviated weekday names (%a)
+abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
+ "<U0053><U0061><U0074>"
+
+% Full weekday names (%A)
+day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
+
+% Abbreviated month names (%b)
+abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
+
+% Full month names (%B)
+mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
+ "<U004D><U0061><U0072><U0063><U0068>";/
+ "<U0041><U0070><U0072><U0069><U006C>";/
+ "<U004D><U0061><U0079>";/
+ "<U004A><U0075><U006E><U0065>";/
+ "<U004A><U0075><U006C><U0079>";/
+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
+
+% Week description, consists of three fields:
+% 1. Number of days in a week.
+% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
+% 3. The weekday number to be contained in the first week of the year.
+%
+% ISO 8601 conforming applications should use the values 7, 19971201 (a
+% Monday), and 4 (Thursday), respectively.
+week 7;19971201;4
+first_weekday 1
+first_workday 1
+
+% Appropriate date and time representation (%c)
+% "%a %b %e %H:%M:%S %Y"
+d_t_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059>"
+
+% Appropriate date representation (%x)
+% "%m/%d/%y"
+d_fmt "<U0025><U006D><U002F><U0025><U0064><U002F><U0025><U0079>"
+
+% Appropriate time representation (%X)
+% "%H:%M:%S"
+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
+
+% Appropriate AM/PM time representation (%r)
+% "%I:%M:%S %p"
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
+
+% Equivalent of AM/PM (%p) "AM"/"PM"
+%
+am_pm "<U0041><U004D>";"<U0050><U004D>"
+
+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U0025><U0059>"
+END LC_TIME
+
+LC_MESSAGES
+% This is the POSIX Locale definition for
+% the LC_NUMERIC category.
+%
+yesexpr "<U005E><U005B><U0079><U0059><U005D>"
+noexpr "<U005E><U005B><U006E><U004E><U005D>"
+yesstr "<U0059><U0065><U0073>"
+nostr "<U004E><U006F>"
+END LC_MESSAGES
+
+LC_PAPER
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_PAPER category.
+% (A4 paper, this is also used in the built in C/POSIX
+% locale in glibc/locale/C-paper.c)
+height 297
+width 210
+END LC_PAPER
+
+LC_NAME
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_NAME category.
+% "%p%t%g%t%m%t%f"
+% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_ADDRESS category.
+% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
+% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_TELEPHONE category.
+% "+%c %a %l"
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
+<U006C>"
+% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_MEASUREMENT category.
+% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
+%metric
+measurement 1
+END LC_MEASUREMENT
+

View File

@ -8,7 +8,7 @@ Index: glibc-2.27/csu/version.c
static const char banner[] =
-"GNU C Library "PKGVERSION RELEASE" release version "VERSION".\n\
+"GNU C Library "PKGVERSION RELEASE" release version "VERSION" (git "GITID").\n\
Copyright (C) 2021 Free Software Foundation, Inc.\n\
Copyright (C) 2022 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n\

View File

@ -1,3 +1,99 @@
-------------------------------------------------------------------
Thu Feb 3 11:52:01 UTC 2022 - Andreas Schwab <schwab@suse.de>
- Update to glibc 2.35
Major new features:
* Unicode 14.0.0 Support
* Bump r_version in the debugger interface to 2
* Support for the C.UTF-8 locale has been added to glibc
* <math.h> functions that round their results to a narrower type, and
corresponding <tgmath.h> macros, are added from TS 18661-1:2014, TS
18661-3:2015 and draft ISO C2X
* <math.h> functions for floating-point maximum and minimum,
corresponding to new operations in IEEE 754-2019, and corresponding
<tgmath.h> macros, are added from draft ISO C2X
* <math.h> macros for single-precision float constants are added as a
GNU extension
* The __STDC_IEC_60559_BFP__ and __STDC_IEC_60559_COMPLEX__ macros are
predefined as specified in TS 18661-1:2014
* The exp10 functions in <math.h> now have a corresponding type-generic
macro in <tgmath.h>
* The ISO C2X macro _PRINTF_NAN_LEN_MAX has been added to <stdio.h>
* printf-family functions now support the %b format for output of
integers in binary, as specified in draft ISO C2X, and the %B variant
of that format recommended by draft ISO C2X
* A new DSO sorting algorithm has been added in the dynamic linker that uses
topological sorting by depth-first search (DFS), solving performance issues
of the existing sorting algorithm when encountering particular circular
object dependency cases
* A new tunable, glibc.rtld.dynamic_sort, can be used to select between
the two DSO sorting algorithms
* ABI support for a new function '__memcmpeq'. '__memcmpeq' is meant
to be used by compilers for optimizing usage of 'memcmp' when its
return value is only used for its boolean status
* Support for automatically registering threads with the Linux rseq
system call has been added
* A symbolic link to the dynamic linker is now installed under
/usr/bin/ld.so (or more precisely, '${bindir}/ld.so')
* All programs and the testsuite in glibc are now built as position independent
executables (PIE) by default on toolchains and architectures that support it
* On Linux, a new tunable, glibc.malloc.hugetlb, can be used to
either make malloc issue madvise plus MADV_HUGEPAGE on mmap and sbrk
or to use huge pages directly with mmap calls with the MAP_HUGETLB
flags)
* The printf family of functions now handles the flagged %#m conversion
specifier, printing errno as an error constant (similar to strerrorname_np)
* The function _dl_find_object has been added
* On Linux, the epoll_pwait2 function has been added
* The function posix_spawn_file_actions_addtcsetpgrp_np has been added,
enabling posix_spawn and posix_spawnp to set the controlling terminal in
the new process in a race free manner
* Source fortification (_FORTIFY_SOURCE) level 3 is now available for
applications compiling with glibc and gcc 12 and later
Deprecated and removed features, and other changes affecting compatibility:
* On x86-64, the LD_PREFER_MAP_32BIT_EXEC environment variable support
has been removed since the first PT_LOAD segment is no longer executable
due to defaulting to -z separate-code
* The r_version update in the debugger interface makes the glibc binary
incompatible with GDB
* Intel MPX support (lazy PLT, ld.so profile, and LD_AUDIT) has been removed
* The catchsegv script and associated libSegFault.so shared object have
been removed
* Support for prelink will be removed in the next release; this includes
removal of the LD_TRACE_PRELINKING, and LD_USE_LOAD_BIAS, environment
variables and their functionality in the dynamic loader
Changes to build and runtime requirements:
* The audit module interface version LAV_CURRENT is increased to enable
proper bind-now support
* The audit interface on aarch64 is extended to support both the indirect
result location register (x8) and NEON Q register
Security related changes:
* CVE-2022-23219: Passing an overlong file name to the clnt_create
legacy function could result in a stack-based buffer overflow when
using the "unix" protocol
* CVE-2022-23218: Passing an overlong file name to the svcunix_create
legacy function could result in a stack-based buffer overflow
* CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath
function could result in a memory leak and potential access of
uninitialized memory
* CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd
function may result in an off-by-one buffer underflow and overflow
when the current working directory is longer than PATH_MAX and also
corresponds to the / directory through an unprivileged mount
namespace
- copy-and-spawn-sgid-double-close.patch,
fcntl-time-bits-64-redirect.patch, gaiconf-init-double-free.patch,
gconv-parseconfdir-memory-leak.patch, getcwd-attribute-access.patch,
glibc-c-utf8-locale.patch, iconv-charmap-close-output.patch,
ld-show-auxv-colon.patch, ldconfig-leak-empty-paths.patch,
librt-null-pointer.patch, pthread-kill-fail-after-exit.patch,
pthread-kill-race-thread-exit.patch, pthread-kill-return-esrch.patch,
pthread-kill-send-specific-thread.patch,
pthread-mutexattr-getrobust-np-type.patch,
setxid-deadlock-blocked-signals.patch,
sysconf-nprocessors-affinity.patch, x86-string-control-test.patch:
Removed.
-------------------------------------------------------------------
Fri Nov 26 13:38:02 UTC 2021 - Michael Matz <matz@suse.com>

View File

@ -111,18 +111,18 @@ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6C
nrQzvJbBn6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQAB
tCBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PokCVQQTAQgAPwIbAwYL
CQgHAwIGFQgCCQoLBBYCAwECHgECF4AWIQR+N5Kp2Kz31jO8FYjtl+kOYqp+NAUC
XyW9lwUJFK4LswAKCRDtl+kOYqp+NKNVD/9HMsI1606n0UuTXHwITsyOjAI9SDOT
+C3DUv6qlM5BH2nWAMTiIiyA5uglsJv93oi2vNtFf/Q/m/1cnZWgnVnExkyLI4EN
Sd1uBvr0/lCSdPlP0Mg6GWSpXMu+x0vdT0AaZNOTE0FnPuoldc3XD76C2qg8sX/i
axXTKHy9P+BlAq/Cs7/pxDQ0EzSn0USZ2C0l5vv4PMpA/picnS6K609JvDGaORmw
ZeXIZqQNZV+ZQs+UYtVoguDTqby3IUY1I8BlXHRptaj9AMn4Uoh/CqpQlVojoyWl
HqaFnnJBKeF0hvJ9SAyalwuzAjG7vQW07MYncaOFm0woiKbg5JLO8F4SBTIkuO0D
Cf9nLAay6VsB4rzwdEfRwjPLYAn7MR3fvHCEzfrkldTraiBO1T0ieDK80I7sLf6p
MeCYI19pUlx0/NRMGCddiFIQdfthKWXGRS5LAs8jwBf8H6G5PWinPrEIaomIP21i
vuhQD07bYq9IiIdeljjUdHcGI0i/B4M56Zaa8Ff38iniOlrDYCmYWR4dCWZiuQeZ
3OgqeQs9a6jTvgdDGVmRVqY+jzk8PlaHfcok8ROhFcHKkcfhuBhL25hlRIshRDOE
skXqKwnzrbqga3GXZXfsXAoFbzNhLdLv9A+LJAYSkXP6/5qdTpELVGosyH884Vdb
BpkGI04oYVqulYkCHAQQAQIABgUCVi604AAKCRDNVPzj2WS++xxpD/4hZPbOUfcF
YTAc/AUJHhWsGAAKCRDtl+kOYqp+NBKwD/9Qise9/wZsD8Nyl+ADOCIAFZY5qlSl
/5SyCjJIRc6cx/Z0fm4yJVH2Tf3GlSBk1uW24z8+mB2ZxFQUGjio/2iDndSqxYR4
qvPGudo4RGvdvhw6LLqTdRsAY4947xLpNUO6gDtZsRpn4isn+ViX85XfGJrIFjBm
zj70eMxEZZrz1IMfUB5I/2oNGDsXDZlCUU30RFMYChGA1ofpIHWdAs+lW2jVBfeE
Lbi2su+oUpqrx83u0eJQg3RY3jmPjw8snHS4ieXpvS0e89qziBlNCqS59qJHaf4G
XCjz+o5gap2e0NEeQYqcyCqAfqjI78KEpVJNQx5D/zSOvnNs6KuzWD7No4nb5A3p
A6KA1JAwJW0H3F2+RhTEg+kFxpcCen0jjuFBnE3TfO3RSpSGqZN0j4AkuR6h/+I7
uUfaQAAope4mso/9VBEElaHYTQmA/m4/AXb2Kt/qkt6QgUIyJtSKcMCVTbfL6iIj
rzu4EzkjtZJkbAfvU8lpkUsWX2Qwo25MwyxyzsHMUq9ccIRPEiI0hVu7jeFAql6c
ql/3KUWvSr8QCyn7KWhfxyzy6j0+2xtQ29LHAOhboawJJoZd+PtintzHSSZ6G+8T
Xn3EbjmHHlXWWfnvWyaJCuJzf1PybRgNYqL6EXCHRHCIb4S9Av8sJpJzZiskG1v5
WUkv79aHb1ol14kCHAQQAQIABgUCVi604AAKCRDNVPzj2WS++xxpD/4hZPbOUfcF
LwePuSD3tqKrcmAq0vmyND1aNSOht0OlUbnHtsWxJmThEVEF25VfPbWhD+DZjRj8
hkQNzgkdeLJXJNj8JqS/MedrVa3j3wzHAnSt6fIQ8VvLmZDYg2gCpZrlU/y15Oby
OrPkgOCC6MC2PFwHnEpAfR0d6AdbZ+ZeLqbvkB/tkMsqroNMSlPtgq8AWCKX++WJ
@ -145,19 +145,19 @@ FuDmiIAQf9WD/wzEfICc+F+uDDI+uYkRxUFp92ykmdhDEFg1yjYsU8iGU69aHyvh
q36z4zctvbqhRNzOWB1bVJ/dIMDvsExGcXQVDIT7sDNXv0wE3jKSKpp7NDG1oXUX
L+2+SF99Kjy753AbQSAmH617fyBNwhJWvQYg+mUvPpiGOtses9EXUI3lS4v0MEaP
G43flEs1UR+1rpFQWVHo1y1OO+sAEQEAAYkCPAQYAQgAJgIbDBYhBH43kqnYrPfW
M7wViO2X6Q5iqn40BQJfJb2zBQkUrgvPAAoJEO2X6Q5iqn40cnMP/17CgUkXT9aI
JriPM8wbceYrcl7+bdYEf79SlwSbbHN7R4CoIJFOlN9S/34typGVYvpgmCJDYFTB
xyPO92iMXDgA4+cWHzt5T1aYO9hsKhh7vDtK+6ProZGc+08gUTXHhb97hMMQhknJ
lnfjpSEC9em906FU+I93T1fTGupnBa3aWcK8jM0JaBGby2hG1S3olaDLSTtBINNB
YmvuWR9MKOhhqDrlk5cwFDJLh5NrXteEY08WAzcLzG3pkrXPHkFeMQtfqk0jLdGG
vGC3NCIkqYrdLhiRvGpru38C26REn5f4I0vGE3VfIXHe8TMCNmQut1NtMuUmpDIy
1aLxGzuptUhnOJN//r+VjDPoi3LOySNYphqe/dMubsfUr6ohP41mKF81FuwI4amq
JtrqIL2yqax3a0qlfwCxXftieqJcuekX+eCPDCKrYMXR0FYgwpG2ITZUGtrEjESl
E6Dscx734HKdr5ORIocLUUKEOGeiU6DGhGFdb5Twu0Sn+u1mUPDN0M++CdMvClIE
8klo4G91EOImu1Upb8xcOPQwxh1jwqSrU5QwoNmSYegQSHLpIUurFz1iQUh1vpPX
zKinkWEqv4IqA1ciL+LyySuLkp7MsJpVRMbWJCNWOOSbaH4oDBJ5dHMGc35x5mos
Ck90PXknuFDDsYHfDo5smf9lo6YXx7N9
=QLCc
M7wViO2X6Q5iqn40BQJhMB1RBQkeFaxtAAoJEO2X6Q5iqn40d5QP/iRm1LyrCKbM
dqgP9ShOcPH7UfFEr4SY2TDdQgE4L+QItP16RNgTxAkxaBxK95I0nletr03inRKw
sb0dIw/BH2LXbG2DjI6yKJK6UThVhWWBXYuGjSv2i6bVIzHLRY3IOQF+8dyVJ+vo
eaOtxdV1lYR1ke/Dv6pFqUGGNBsSVu/2R03uCffTA9OsRzbuV5mJrFgxVFmBAguL
N/cT5Ffh77x3LsA61Ro3hIX4399GFFBQ3h4RfMA1nNWiU0KjNy/GtW0amxn26zhq
Qvy0W0hEJRA6ts+e/4ZHwcX3U7NTnPTckbCyy71d7U8/AVHkoy7EB8ROcDbJHTJc
KlG9f6eYlPZ2aYVqBd9n1Yj4NYT1zobrQjvHQRCUAx0naKscN2es9x/rWvg4BnnB
cXRaT2a8Wy3pKzLGD61dstvUM7tnyvdBxHk7aLlbdsfZP+flP2tbHkFNZWH5myPE
lPMcQGFYyi9to+4YZU28G3rnzxmKFWkYAEMaxPZPunOZnOBHURFhgk/qs6GYSTPv
g0u/kd1JV2yOKHb8+SB/Dpk/gx9KybTUC3TtbW1b2X94ErB8LCmpMi26a3ZvyxrE
5DJx2GdUoj2QkKTSFQV7MOo1tJ9vwtSfHnpT/+E6yKtzCLl9CNiVjd57puN1BhWC
VvLwfAzUC2UvpPYh8u3maJaMAC6BgK78
=JpE/
-----END PGP PUBLIC KEY BLOCK-----
GPG keys of Ian Wienand <ianw>

View File

@ -170,10 +170,10 @@ BuildArch: i686
%define enablekernel 4.15
%endif
Version: 2.34
Version: 2.35
Release: 0
%if !%{build_snapshot}
%define git_id ae37d06c7d
%define git_id f94f6d8a35
%define libversion %version
%else
%define git_id %(echo %version | sed 's/.*\.g//')
@ -271,10 +271,8 @@ Patch100: add-locales.patch
Patch102: glibc-2.4.90-no_NO.diff
# PATCH-FIX-OPENSUSE -- Renames for China
Patch103: glibc-2.4-china.diff
# PATCH-FIX-OPENSUSE -- Add C.UTF-8 locale
Patch104: glibc-c-utf8-locale.patch
# PATCH-FIX-OPENSUSE -- Disable gettext for C.UTF-8 locale
Patch105: glibc-disable-gettext-for-c-utf8.patch
Patch104: glibc-disable-gettext-for-c-utf8.patch
### Network related patches
# PATCH-FIX-OPENSUSE Warn about usage of mdns in resolv.conv
@ -285,40 +283,6 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM ldconfig: avoid leak on empty paths in config file
Patch1000: ldconfig-leak-empty-paths.patch
# PATCH-FIX-UPSTREAM gconv_parseconfdir: Fix memory leak
Patch1001: gconv-parseconfdir-memory-leak.patch
# PATCH-FIX-UPSTREAM gaiconf_init: Avoid double-free in label and precedence lists
Patch1002: gaiconf-init-double-free.patch
# PATCH-FIX-UPSTREAM copy_and_spawn_sgid: Avoid double calls to close()
Patch1003: copy-and-spawn-sgid-double-close.patch
# PATCH-FIX-UPSTREAM iconv_charmap: Close output file when done
Patch1004: iconv-charmap-close-output.patch
# PATCH-FIX-UPSTREAM Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (BZ #28182)
Patch1005: fcntl-time-bits-64-redirect.patch
# PATCH-FIX-UPSTREAM librt: fix NULL pointer dereference (BZ #28213)
Patch1006: librt-null-pointer.patch
# PATCH-FIX-UPSTREAM elf: Fix missing colon in LD_SHOW_AUXV output (BZ #282539
Patch1007: ld-show-auxv-colon.patch
# PATCH-FIX-UPSTREAM x86-64: Use testl to check __x86_string_control
Patch1008: x86-string-control-test.patch
# PATCH-FIX-UPSTREAM nptl: pthread_kill, pthread_cancel should not fail after exit (BZ #19193)
Patch1009: pthread-kill-fail-after-exit.patch
# PATCH-FIX-UPSTREAM nptl: Fix race between pthread_kill and thread exit (BZ #12889)
Patch1010: pthread-kill-race-thread-exit.patch
# PATCH-FIX-UPSTREAM posix: Fix attribute access mode on getcwd (BZ #27476)
Patch1011: getcwd-attribute-access.patch
# PATCH-FIX-UPSTREAM nptl: pthread_kill needs to return ESRCH for old programs (BZ #19193)
Patch1012: pthread-kill-return-esrch.patch
# PATCH-FIX-UPSTREAM nptl: Fix type of pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np (BZ #28036)
Patch1013: pthread-mutexattr-getrobust-np-type.patch
# PATCH-FIX-UPSTREAM nptl: Avoid setxid deadlock with blocked signals in thread exit (BZ #28361)
Patch1014: setxid-deadlock-blocked-signals.patch
# PATCH-FIX-UPSTREAM nptl: pthread_kill must send signals to a specific thread (BZ #28407)
Patch1015: pthread-kill-send-specific-thread.patch
# PATCH-FIX-UPSTREAM linux: Revert the use of sched_getaffinity on get_nproc (BZ #28310)
Patch1016: sysconf-nprocessors-affinity.patch
###
# Patches awaiting upstream approval
@ -534,7 +498,6 @@ library in a cross compilation setting.
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch304 -p1
%patch306 -p1
@ -542,25 +505,8 @@ library in a cross compilation setting.
%patch2000 -p1
%patch2001 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch3000
rm -f manpages/catchsegv.1
%build
# Disable LTO due to a usage of top-level assembler that
@ -683,11 +629,6 @@ profile="--enable-profile"
profile="--disable-profile"
%endif
CONFARGS=
case " %{ix86} x86_64 aarch64 " in
*" %{host_arch} "*) CONFARGS="$CONFARGS --enable-static-pie" ;;
esac
../configure \
CFLAGS="$BuildFlags" BUILD_CFLAGS="$BuildFlags" \
CC="$BuildCC" CXX="$BuildCCplus" \
@ -720,7 +661,6 @@ esac
%endif
--enable-systemtap \
%endif
$CONFARGS \
%if %{enable_stackguard_randomization}
--enable-stackguard-randomization \
%endif
@ -1062,7 +1002,7 @@ rm -f %{buildroot}%{_libdir}/lib*
%else
rm -f %{buildroot}%{_libdir}/lib*.a
%endif
rm -f %{buildroot}%{_bindir}/{catchsegv,ldd*,sprof}
rm -f %{buildroot}%{_bindir}/{ld.so,ldd*,sprof}
rm -rf %{buildroot}%{_mandir}/man*
rm -rf %{buildroot}%{rootsbindir} %{buildroot}%{_includedir}
%ifarch riscv64
@ -1219,6 +1159,7 @@ exit 0
%doc %{_mandir}/man1/getconf.1.gz
%doc %{_mandir}/man5/*
%{_bindir}/ld.so
%{rtlddir}/%{rtld_name}
%if 0%{?rtld_oldname:1}
%{rtlddir}/%{rtld_oldname}
@ -1236,7 +1177,6 @@ exit 0
%endif
%{slibdir}/libBrokenLocale.so.1
%{slibdir}/libSegFault.so
%{slibdir}/libanl.so.1
%{slibdir}/libc.so.6*
%{slibdir}/libc_malloc_debug.so.0
@ -1298,9 +1238,7 @@ exit 0
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc NEWS README
%doc %{_mandir}/man1/catchsegv.1.gz
%doc %{_mandir}/man3/*
%{_bindir}/catchsegv
%{_bindir}/sprof
%{_includedir}/*
%{_libdir}/*.o

View File

@ -1,26 +0,0 @@
From 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:29 +0530
Subject: [PATCH] iconv_charmap: Close output file when done
Reviewed-by: Arjun Shankar <arjun@redhat.com>
---
iconv/iconv_charmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
index e2d53fee3c..a8b6b56124 100644
--- a/iconv/iconv_charmap.c
+++ b/iconv/iconv_charmap.c
@@ -234,6 +234,8 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
while (++remaining < argc);
/* All done. */
+ if (output != stdout)
+ fclose (output);
free_table (cvtbl);
return status;
}
--
2.32.0

View File

@ -1,29 +0,0 @@
From 9acab0bba6a5a57323b1f94bf95b21618a9e5aa4 Mon Sep 17 00:00:00 2001
From: Arjun Shankar <arjun@redhat.com>
Date: Fri, 20 Aug 2021 16:24:05 +0200
Subject: [PATCH] elf: Fix missing colon in LD_SHOW_AUXV output [BZ #28253]
This commit adds a missing colon in the AT_MINSIGSTKSZ entry in
the _dl_show_auxv function.
(cherry picked from commit 82fbcd7118d760492e2ecc9fa291e358b9ba0361)
---
elf/dl-sysdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index d47bef1340..2c684c2db2 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -317,7 +317,7 @@ _dl_show_auxv (void)
[AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex },
[AT_RANDOM - 2] = { "RANDOM: 0x", hex },
[AT_HWCAP2 - 2] = { "HWCAP2: 0x", hex },
- [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ ", dec },
+ [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ: ", dec },
[AT_L1I_CACHESIZE - 2] = { "L1I_CACHESIZE: ", dec },
[AT_L1I_CACHEGEOMETRY - 2] = { "L1I_CACHEGEOMETRY: 0x", hex },
[AT_L1D_CACHESIZE - 2] = { "L1D_CACHESIZE: ", dec },
--
2.33.0

View File

@ -1,30 +0,0 @@
From b0234d79e7d82475d1666f25326ec045c045b3ed Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:10 +0530
Subject: [PATCH] ldconfig: avoid leak on empty paths in config file
Reviewed-by: Arjun Shankar <arjun@redhat.com>
---
elf/ldconfig.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 1037e8d0cf..b8893637f8 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -503,7 +503,11 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
entry->path[--i] = '\0';
if (i == 0)
- return;
+ {
+ free (entry->path);
+ free (entry);
+ return;
+ }
char *path = entry->path;
if (opt_chroot != NULL)
--
2.32.0

View File

@ -1,39 +0,0 @@
From b805aebd42364fe696e417808a700fdb9800c9e8 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npv1310@gmail.com>
Date: Mon, 9 Aug 2021 20:17:34 +0530
Subject: [PATCH] librt: fix NULL pointer dereference (bug 28213)
Helper thread frees copied attribute on NOTIFY_REMOVED message
received from the OS kernel. Unfortunately, it fails to check whether
copied attribute actually exists (data.attr != NULL). This worked
earlier because free() checks passed pointer before actually
attempting to release corresponding memory. But
__pthread_attr_destroy assumes pointer is not NULL.
So passing NULL pointer to __pthread_attr_destroy will result in
segmentation fault. This scenario is possible if
notification->sigev_notify_attributes == NULL (which means default
thread attributes should be used).
Signed-off-by: Nikita Popov <npv1310@gmail.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
sysdeps/unix/sysv/linux/mq_notify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index 9799dcdaa4..eccae2e4c6 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -131,7 +131,7 @@ helper_thread (void *arg)
to wait until it is done with it. */
(void) __pthread_barrier_wait (&notify_barrier);
}
- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
{
/* The only state we keep is the copy of the thread attributes. */
__pthread_attr_destroy (data.attr);
--
2.32.0

View File

@ -1,178 +0,0 @@
From 3abf3bd4edc86fb28c099cc85203cb46a811e0b8 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 13 Sep 2021 11:06:08 +0200
Subject: [PATCH] nptl: pthread_kill, pthread_cancel should not fail after exit
(bug 19193)
This closes one remaining race condition related to bug 12889: if
the thread already exited on the kernel side, returning ESRCH
is not correct because that error is reserved for the thread IDs
(pthread_t values) whose lifetime has ended. In case of a
kernel-side exit and a valid thread ID, no signal needs to be sent
and cancellation does not have an effect, so just return 0.
sysdeps/pthread/tst-kill4.c triggers undefined behavior and is
removed with this commit.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 8af8456004edbab71f8903a60a3cae442cf6fe69)
---
NEWS | 1 +
nptl/pthread_cancel.c | 9 ++-
nptl/pthread_kill.c | 7 +-
sysdeps/pthread/Makefile | 5 +-
sysdeps/pthread/tst-kill4.c | 90 ---------------------
sysdeps/pthread/tst-pthread_cancel-exited.c | 45 +++++++++++
sysdeps/pthread/tst-pthread_kill-exited.c | 46 +++++++++++
7 files changed, 107 insertions(+), 96 deletions(-)
delete mode 100644 sysdeps/pthread/tst-kill4.c
create mode 100644 sysdeps/pthread/tst-pthread_cancel-exited.c
create mode 100644 sysdeps/pthread/tst-pthread_kill-exited.c
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index cc25ff21f3..9bac6e3b76 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -62,10 +62,11 @@ __pthread_cancel (pthread_t th)
{
volatile struct pthread *pd = (volatile struct pthread *) th;
- /* Make sure the descriptor is valid. */
- if (INVALID_TD_P (pd))
- /* Not a valid thread handle. */
- return ESRCH;
+ if (pd->tid == 0)
+ /* The thread has already exited on the kernel side. Its outcome
+ (regular exit, other cancelation) has already been
+ determined. */
+ return 0;
static int init_sigcancel = 0;
if (atomic_load_relaxed (&init_sigcancel) == 0)
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index f79a2b26fc..5d4c86f920 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -46,7 +46,12 @@ __pthread_kill_internal (pthread_t threadid, int signo)
? INTERNAL_SYSCALL_ERRNO (val) : 0);
}
else
- val = ESRCH;
+ /* The kernel reports that the thread has exited. POSIX specifies
+ the ESRCH error only for the case when the lifetime of a thread
+ ID has ended, but calling pthread_kill on such a thread ID is
+ undefined in glibc. Therefore, do not treat kernel thread exit
+ as an error. */
+ val = 0;
return val;
}
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 42f9fc5072..dedfa0d290 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -89,7 +89,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
tst-join8 tst-join9 tst-join10 tst-join11 tst-join12 tst-join13 \
tst-join14 tst-join15 \
tst-key1 tst-key2 tst-key3 tst-key4 \
- tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
+ tst-kill1 tst-kill2 tst-kill3 tst-kill5 tst-kill6 \
tst-locale1 tst-locale2 \
tst-memstream \
tst-mutex-errorcheck tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 \
diff --git a/sysdeps/pthread/tst-kill4.c b/sysdeps/pthread/tst-kill4.c
deleted file mode 100644
index 9563939792..0000000000
--- a/sysdeps/pthread/tst-kill4.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2003-2021 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-
-static void *
-tf (void *a)
-{
- return NULL;
-}
-
-
-int
-do_test (void)
-{
- pthread_attr_t at;
- if (pthread_attr_init (&at) != 0)
- {
- puts ("attr_create failed");
- exit (1);
- }
-
- /* Limit thread stack size, because if it is too large, pthread_join
- will free it immediately rather than put it into stack cache. */
- if (pthread_attr_setstacksize (&at, 2 * 1024 * 1024) != 0)
- {
- puts ("setstacksize failed");
- exit (1);
- }
-
- pthread_t th;
- if (pthread_create (&th, &at, tf, NULL) != 0)
- {
- puts ("create failed");
- exit (1);
- }
-
- pthread_attr_destroy (&at);
-
- if (pthread_join (th, NULL) != 0)
- {
- puts ("join failed");
- exit (1);
- }
-
- /* The following only works because we assume here something about
- the implementation. Namely, that the memory allocated for the
- thread descriptor is not going away, that the TID field is
- cleared and therefore the signal is sent to process 0, and that
- we can savely assume there is no other process with this ID at
- that time. */
- int e = pthread_kill (th, 0);
- if (e == 0)
- {
- puts ("pthread_kill succeeded");
- exit (1);
- }
- if (e != ESRCH)
- {
- puts ("pthread_kill didn't return ESRCH");
- exit (1);
- }
-
- return 0;
-}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"

View File

@ -1,424 +0,0 @@
From a8ac8c4725ddb1119764126a8674a04c9dd5aea8 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 13 Sep 2021 11:06:08 +0200
Subject: [PATCH] nptl: Fix race between pthread_kill and thread exit (bug
12889)
A new thread exit lock and flag are introduced. They are used to
detect that the thread is about to exit or has exited in
__pthread_kill_internal, and the signal is not sent in this case.
The test sysdeps/pthread/tst-pthread_cancel-select-loop.c is derived
from a downstream test originally written by Marek Polacek.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be)
---
NEWS | 1 +
nptl/allocatestack.c | 3 +
nptl/descr.h | 6 +
nptl/pthread_create.c | 14 ++
nptl/pthread_kill.c | 65 +++++----
sysdeps/pthread/Makefile | 2 +
.../pthread/tst-pthread_cancel-select-loop.c | 87 +++++++++++++
sysdeps/pthread/tst-pthread_kill-exiting.c | 123 ++++++++++++++++++
8 files changed, 276 insertions(+), 25 deletions(-)
create mode 100644 sysdeps/pthread/tst-pthread_cancel-select-loop.c
create mode 100644 sysdeps/pthread/tst-pthread_kill-exiting.c
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index cfe37a3443..50065bc9bd 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -32,6 +32,7 @@
#include <futex-internal.h>
#include <kernel-features.h>
#include <nptl-stack.h>
+#include <libc-lock.h>
/* Default alignment of stack. */
#ifndef STACK_ALIGN
@@ -127,6 +128,8 @@ get_cached_stack (size_t *sizep, void **memp)
/* No pending event. */
result->nextevent = NULL;
+ result->exiting = false;
+ __libc_lock_init (result->exit_lock);
result->tls_state = (struct tls_internal_t) { 0 };
/* Clear the DTV. */
diff --git a/nptl/descr.h b/nptl/descr.h
index c85778d449..4de84138fb 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -396,6 +396,12 @@ struct pthread
PTHREAD_CANCEL_ASYNCHRONOUS). */
unsigned char canceltype;
+ /* Used in __pthread_kill_internal to detected a thread that has
+ exited or is about to exit. exit_lock must only be acquired
+ after blocking signals. */
+ bool exiting;
+ int exit_lock; /* A low-level lock (for use with __libc_lock_init etc). */
+
/* Used on strsignal. */
struct tls_internal_t tls_state;
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index d8ec299cb1..33b426fc68 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -37,6 +37,7 @@
#include <sys/single_threaded.h>
#include <version.h>
#include <clone_internal.h>
+#include <futex-internal.h>
#include <shlib-compat.h>
@@ -485,6 +486,19 @@ start_thread (void *arg)
/* This was the last thread. */
exit (0);
+ /* This prevents sending a signal from this thread to itself during
+ its final stages. This must come after the exit call above
+ because atexit handlers must not run with signals blocked. */
+ __libc_signal_block_all (NULL);
+
+ /* Tell __pthread_kill_internal that this thread is about to exit.
+ If there is a __pthread_kill_internal in progress, this delays
+ the thread exit until the signal has been queued by the kernel
+ (so that the TID used to send it remains valid). */
+ __libc_lock_lock (pd->exit_lock);
+ pd->exiting = true;
+ __libc_lock_unlock (pd->exit_lock);
+
#ifndef __ASSUME_SET_ROBUST_LIST
/* If this thread has any robust mutexes locked, handle them now. */
# if __PTHREAD_MUTEX_HAVE_PREV
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index 5d4c86f920..fb7862eff7 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -16,6 +16,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <libc-lock.h>
#include <unistd.h>
#include <pthreadP.h>
#include <shlib-compat.h>
@@ -23,37 +24,51 @@
int
__pthread_kill_internal (pthread_t threadid, int signo)
{
- pid_t tid;
struct pthread *pd = (struct pthread *) threadid;
-
if (pd == THREAD_SELF)
- /* It is a special case to handle raise() implementation after a vfork
- call (which does not update the PD tid field). */
- tid = INLINE_SYSCALL_CALL (gettid);
- else
- /* Force load of pd->tid into local variable or register. Otherwise
- if a thread exits between ESRCH test and tgkill, we might return
- EINVAL, because pd->tid would be cleared by the kernel. */
- tid = atomic_forced_read (pd->tid);
-
- int val;
- if (__glibc_likely (tid > 0))
{
- pid_t pid = __getpid ();
-
- val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
- val = (INTERNAL_SYSCALL_ERROR_P (val)
- ? INTERNAL_SYSCALL_ERRNO (val) : 0);
+ /* Use the actual TID from the kernel, so that it refers to the
+ current thread even if called after vfork. There is no
+ signal blocking in this case, so that the signal is delivered
+ immediately, before __pthread_kill_internal returns: a signal
+ sent to the thread itself needs to be delivered
+ synchronously. (It is unclear if Linux guarantees the
+ delivery of all pending signals after unblocking in the code
+ below. POSIX only guarantees delivery of a single signal,
+ which may not be the right one.) */
+ pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
+ int ret = INTERNAL_SYSCALL_CALL (kill, tid, signo);
+ return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
}
+
+ /* Block all signals, as required by pd->exit_lock. */
+ sigset_t old_mask;
+ __libc_signal_block_all (&old_mask);
+ __libc_lock_lock (pd->exit_lock);
+
+ int ret;
+ if (pd->exiting)
+ /* The thread is about to exit (or has exited). Sending the
+ signal is either not observable (the target thread has already
+ blocked signals at this point), or it will fail, or it might be
+ delivered to a new, unrelated thread that has reused the TID.
+ So do not actually send the signal. Do not report an error
+ because the threadid argument is still valid (the thread ID
+ lifetime has not ended), and ESRCH (for example) would be
+ misleading. */
+ ret = 0;
else
- /* The kernel reports that the thread has exited. POSIX specifies
- the ESRCH error only for the case when the lifetime of a thread
- ID has ended, but calling pthread_kill on such a thread ID is
- undefined in glibc. Therefore, do not treat kernel thread exit
- as an error. */
- val = 0;
+ {
+ /* Using tgkill is a safety measure. pd->exit_lock ensures that
+ the target thread cannot exit. */
+ ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
+ ret = INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
+ }
+
+ __libc_lock_unlock (pd->exit_lock);
+ __libc_signal_restore_set (&old_mask);
- return val;
+ return ret;
}
int
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index dedfa0d290..48dba717a1 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -119,5 +119,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
tst-unwind-thread \
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
+ tst-pthread_cancel-select-loop \
+ tst-pthread_kill-exiting \
tests-time64 := \
tst-abstime-time64 \
diff --git a/sysdeps/pthread/tst-pthread_cancel-select-loop.c b/sysdeps/pthread/tst-pthread_cancel-select-loop.c
new file mode 100644
index 0000000000..a62087589c
--- /dev/null
+++ b/sysdeps/pthread/tst-pthread_cancel-select-loop.c
@@ -0,0 +1,87 @@
+/* Test that pthread_cancel succeeds during thread exit.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* This test tries to trigger an internal race condition in
+ pthread_cancel, where the cancellation signal is sent after the
+ thread has begun the cancellation process. This can result in a
+ spurious ESRCH error. For the original bug 12889, the window is
+ quite small, so the bug was not reproduced in every run. */
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <support/check.h>
+#include <support/xthread.h>
+#include <support/xunistd.h>
+#include <sys/select.h>
+#include <unistd.h>
+
+/* Set to true by timeout_thread_function when the test should
+ terminate. */
+static bool timeout;
+
+static void *
+timeout_thread_function (void *unused)
+{
+ usleep (5 * 1000 * 1000);
+ __atomic_store_n (&timeout, true, __ATOMIC_RELAXED);
+ return NULL;
+}
+
+/* Used for blocking the select function below. */
+static int pipe_fds[2];
+
+static void *
+canceled_thread_function (void *unused)
+{
+ while (true)
+ {
+ fd_set rfs;
+ fd_set wfs;
+ fd_set efs;
+ FD_ZERO (&rfs);
+ FD_ZERO (&wfs);
+ FD_ZERO (&efs);
+ FD_SET (pipe_fds[0], &rfs);
+
+ /* If the cancellation request is recognized early, the thread
+ begins exiting while the cancellation signal arrives. */
+ select (FD_SETSIZE, &rfs, &wfs, &efs, NULL);
+ }
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ xpipe (pipe_fds);
+ pthread_t thr_timeout = xpthread_create (NULL, timeout_thread_function, NULL);
+
+ while (!__atomic_load_n (&timeout, __ATOMIC_RELAXED))
+ {
+ pthread_t thr = xpthread_create (NULL, canceled_thread_function, NULL);
+ xpthread_cancel (thr);
+ TEST_VERIFY (xpthread_join (thr) == PTHREAD_CANCELED);
+ }
+
+ xpthread_join (thr_timeout);
+ xclose (pipe_fds[0]);
+ xclose (pipe_fds[1]);
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/pthread/tst-pthread_kill-exiting.c b/sysdeps/pthread/tst-pthread_kill-exiting.c
new file mode 100644
index 0000000000..f803e94f11
--- /dev/null
+++ b/sysdeps/pthread/tst-pthread_kill-exiting.c
@@ -0,0 +1,123 @@
+/* Test that pthread_kill succeeds during thread exit.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* This test verifies that pthread_kill for a thread that is exiting
+ succeeds (with or without actually delivering the signal). */
+
+#include <array_length.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <support/xsignal.h>
+#include <support/xthread.h>
+#include <unistd.h>
+
+/* Set to true by timeout_thread_function when the test should
+ terminate. */
+static bool timeout;
+
+static void *
+timeout_thread_function (void *unused)
+{
+ usleep (1000 * 1000);
+ __atomic_store_n (&timeout, true, __ATOMIC_RELAXED);
+ return NULL;
+}
+
+/* Used to synchronize the sending threads with the target thread and
+ main thread. */
+static pthread_barrier_t barrier_1;
+static pthread_barrier_t barrier_2;
+
+/* The target thread to which signals are to be sent. */
+static pthread_t target_thread;
+
+/* Set by the main thread to true after timeout has been set to
+ true. */
+static bool exiting;
+
+static void *
+sender_thread_function (void *unused)
+{
+ while (true)
+ {
+ /* Wait until target_thread has been initialized. The target
+ thread and main thread participate in this barrier. */
+ xpthread_barrier_wait (&barrier_1);
+
+ if (exiting)
+ break;
+
+ xpthread_kill (target_thread, SIGUSR1);
+
+ /* Communicate that the signal has been sent. The main thread
+ participates in this barrier. */
+ xpthread_barrier_wait (&barrier_2);
+ }
+ return NULL;
+}
+
+static void *
+target_thread_function (void *unused)
+{
+ target_thread = pthread_self ();
+ xpthread_barrier_wait (&barrier_1);
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ xsignal (SIGUSR1, SIG_IGN);
+
+ pthread_t thr_timeout = xpthread_create (NULL, timeout_thread_function, NULL);
+
+ pthread_t threads[4];
+ xpthread_barrier_init (&barrier_1, NULL, array_length (threads) + 2);
+ xpthread_barrier_init (&barrier_2, NULL, array_length (threads) + 1);
+
+ for (int i = 0; i < array_length (threads); ++i)
+ threads[i] = xpthread_create (NULL, sender_thread_function, NULL);
+
+ while (!__atomic_load_n (&timeout, __ATOMIC_RELAXED))
+ {
+ xpthread_create (NULL, target_thread_function, NULL);
+
+ /* Wait for the target thread to be set up and signal sending to
+ start. */
+ xpthread_barrier_wait (&barrier_1);
+
+ /* Wait for signal sending to complete. */
+ xpthread_barrier_wait (&barrier_2);
+
+ xpthread_join (target_thread);
+ }
+
+ exiting = true;
+
+ /* Signal the sending threads to exit. */
+ xpthread_create (NULL, target_thread_function, NULL);
+ xpthread_barrier_wait (&barrier_1);
+
+ for (int i = 0; i < array_length (threads); ++i)
+ xpthread_join (threads[i]);
+ xpthread_join (thr_timeout);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
--
2.33.0

View File

@ -1,91 +0,0 @@
From 73c7f5a87971de2797f261e1a447f68dce09284b Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 20 Sep 2021 14:56:08 +0200
Subject: [PATCH] nptl: pthread_kill needs to return ESRCH for old programs
(bug 19193)
The fix for bug 19193 breaks some old applications which appear
to use pthread_kill to probe if a thread is still running, something
that is not supported by POSIX.
(cherry picked from commit 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93)
---
nptl/pthread_kill.c | 37 ++++++++++++++++++-----
sysdeps/pthread/tst-pthread_kill-exited.c | 21 +++++++++++--
2 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index fb7862eff7..a44dc8f2d9 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -21,8 +21,11 @@
#include <pthreadP.h>
#include <shlib-compat.h>
-int
-__pthread_kill_internal (pthread_t threadid, int signo)
+/* Sends SIGNO to THREADID. If the thread is about to exit or has
+ already exited on the kernel side, return NO_TID. Otherwise return
+ 0 or an error code. */
+static int
+__pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
{
struct pthread *pd = (struct pthread *) threadid;
if (pd == THREAD_SELF)
@@ -52,11 +55,8 @@ __pthread_kill_internal (pthread_t threadid, int signo)
signal is either not observable (the target thread has already
blocked signals at this point), or it will fail, or it might be
delivered to a new, unrelated thread that has reused the TID.
- So do not actually send the signal. Do not report an error
- because the threadid argument is still valid (the thread ID
- lifetime has not ended), and ESRCH (for example) would be
- misleading. */
- ret = 0;
+ So do not actually send the signal. */
+ ret = no_tid;
else
{
/* Using tgkill is a safety measure. pd->exit_lock ensures that
@@ -71,6 +71,15 @@ __pthread_kill_internal (pthread_t threadid, int signo)
return ret;
}
+int
+__pthread_kill_internal (pthread_t threadid, int signo)
+{
+ /* Do not report an error in the no-tid case because the threadid
+ argument is still valid (the thread ID lifetime has not ended),
+ and ESRCH (for example) would be misleading. */
+ return __pthread_kill_implementation (threadid, signo, 0);
+}
+
int
__pthread_kill (pthread_t threadid, int signo)
{
@@ -81,6 +90,7 @@ __pthread_kill (pthread_t threadid, int signo)
return __pthread_kill_internal (threadid, signo);
}
+
/* Some architectures (for instance arm) might pull raise through libgcc, so
avoid the symbol version if it ends up being used on ld.so. */
#if !IS_IN(rtld)
@@ -88,6 +98,17 @@ libc_hidden_def (__pthread_kill)
versioned_symbol (libc, __pthread_kill, pthread_kill, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
-compat_symbol (libc, __pthread_kill, pthread_kill, GLIBC_2_0);
+/* Variant which returns ESRCH in the no-TID case, for backwards
+ compatibility. */
+int
+attribute_compat_text_section
+__pthread_kill_esrch (pthread_t threadid, int signo)
+{
+ if (__is_internal_signal (signo))
+ return EINVAL;
+
+ return __pthread_kill_implementation (threadid, signo, ESRCH);
+}
+compat_symbol (libc, __pthread_kill_esrch, pthread_kill, GLIBC_2_0);
# endif
#endif

View File

@ -1,160 +0,0 @@
From 40bade26d5bcbda3d21fb598c5063d9df62de966 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 1 Oct 2021 18:16:41 +0200
Subject: [PATCH] nptl: pthread_kill must send signals to a specific thread [BZ
#28407]
The choice between the kill vs tgkill system calls is not just about
the TID reuse race, but also about whether the signal is sent to the
whole process (and any thread in it) or to a specific thread.
This was caught by the openposix test suite:
LTP: openposix test suite - FAIL: SIGUSR1 is member of new thread pendingset.
<https://gitlab.com/cki-project/kernel-tests/-/issues/764>
Fixes commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be ("nptl: Fix race
between pthread_kill and thread exit (bug 12889)").
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit eae81d70574e923ce3c59078b8df857ae192efa6)
---
NEWS | 1 +
nptl/pthread_kill.c | 4 +-
sysdeps/pthread/Makefile | 1 +
.../pthread/tst-pthread-raise-blocked-self.c | 92 +++++++++++++++++++
4 files changed, 95 insertions(+), 3 deletions(-)
create mode 100644 sysdeps/pthread/tst-pthread-raise-blocked-self.c
Index: glibc-2.34/nptl/pthread_kill.c
===================================================================
--- glibc-2.34.orig/nptl/pthread_kill.c
+++ glibc-2.34/nptl/pthread_kill.c
@@ -40,7 +40,7 @@ __pthread_kill_implementation (pthread_t
below. POSIX only guarantees delivery of a single signal,
which may not be the right one.) */
pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
- int ret = INTERNAL_SYSCALL_CALL (kill, tid, signo);
+ int ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), tid, signo);
return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
}
@@ -59,8 +59,6 @@ __pthread_kill_implementation (pthread_t
ret = no_tid;
else
{
- /* Using tgkill is a safety measure. pd->exit_lock ensures that
- the target thread cannot exit. */
ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
ret = INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
}
Index: glibc-2.34/sysdeps/pthread/Makefile
===================================================================
--- glibc-2.34.orig/sysdeps/pthread/Makefile
+++ glibc-2.34/sysdeps/pthread/Makefile
@@ -120,6 +120,7 @@ tests += tst-cnd-basic tst-mtx-trylock t
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
tst-pthread-setuid-loop \
tst-pthread_cancel-select-loop \
+ tst-pthread-raise-blocked-self \
tst-pthread_kill-exiting \
tests-time64 := \
Index: glibc-2.34/sysdeps/pthread/tst-pthread-raise-blocked-self.c
===================================================================
--- /dev/null
+++ glibc-2.34/sysdeps/pthread/tst-pthread-raise-blocked-self.c
@@ -0,0 +1,92 @@
+/* Test that raise sends signal to current thread even if blocked.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <signal.h>
+#include <support/check.h>
+#include <support/xsignal.h>
+#include <support/xthread.h>
+#include <pthread.h>
+#include <unistd.h>
+
+/* Used to create a dummy thread ID distinct from all other thread
+ IDs. */
+static void *
+noop (void *ignored)
+{
+ return NULL;
+}
+
+static volatile pthread_t signal_thread;
+
+static void
+signal_handler (int signo)
+{
+ signal_thread = pthread_self ();
+}
+
+/* Used to ensure that waiting_thread has launched and can accept
+ signals. */
+static pthread_barrier_t barrier;
+
+static void *
+waiting_thread (void *ignored)
+{
+ xpthread_barrier_wait (&barrier);
+ pause ();
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ xsignal (SIGUSR1, signal_handler);
+ xpthread_barrier_init (&barrier, NULL, 2);
+
+ /* Distinct thread ID value to */
+ pthread_t dummy = xpthread_create (NULL, noop, NULL);
+ signal_thread = dummy;
+
+ pthread_t helper = xpthread_create (NULL, waiting_thread, NULL);
+
+ /* Make sure that the thread is running. */
+ xpthread_barrier_wait (&barrier);
+
+ /* Block signals on this thread. */
+ sigset_t set;
+ sigfillset (&set);
+ xpthread_sigmask (SIG_BLOCK, &set, NULL);
+
+ /* Send the signal to this thread. It must not be delivered. */
+ raise (SIGUSR1);
+ TEST_VERIFY (signal_thread == dummy);
+
+ /* Wait a bit to give a chance for signal delivery (increases
+ chances of failure with bug 28407). */
+ usleep (50 * 1000);
+
+ /* Unblocking should cause synchronous delivery of the signal. */
+ xpthread_sigmask (SIG_UNBLOCK, &set, NULL);
+ TEST_VERIFY (signal_thread == pthread_self ());
+
+ xpthread_cancel (helper);
+ xpthread_join (helper);
+ xpthread_join (dummy);
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -1,39 +0,0 @@
From 8b8a1d0b7375c547ae905917a03743ed6759c5bc Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 21 Sep 2021 07:12:56 +0200
Subject: [PATCH] nptl: Fix type of pthread_mutexattr_getrobust_np,
pthread_mutexattr_setrobust_np (bug 28036)
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit f3e664563361dc17530113b3205998d1f19dc4d9)
---
NEWS | 1 +
sysdeps/nptl/pthread.h | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index f1b7f2bdc6..43146e91c9 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -933,7 +933,7 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
# ifdef __USE_GNU
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
- (pthread_mutex_t *, int *),
+ (pthread_mutexattr_t *, int *),
pthread_mutexattr_getrobust) __nonnull ((1))
__attribute_deprecated_msg__ ("\
pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
@@ -949,7 +949,7 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
# ifdef __USE_GNU
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
- (pthread_mutex_t *, int),
+ (pthread_mutexattr_t *, int),
pthread_mutexattr_setrobust) __nonnull ((1))
__attribute_deprecated_msg__ ("\
pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
--
2.33.0

View File

@ -1,135 +0,0 @@
From 33adeaa3e2b9143c38884bc5aa65ded222ed274e Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 23 Sep 2021 09:55:54 +0200
Subject: [PATCH] nptl: Avoid setxid deadlock with blocked signals in thread
exit [BZ #28361]
As part of the fix for bug 12889, signals are blocked during
thread exit, so that application code cannot run on the thread that
is about to exit. This would cause problems if the application
expected signals to be delivered after the signal handler revealed
the thread to still exist, despite pthread_kill can no longer be used
to send signals to it. However, glibc internally uses the SIGSETXID
signal in a way that is incompatible with signal blocking, due to the
way the setxid handshake delays thread exit until the setxid operation
has completed. With a blocked SIGSETXID, the handshake can never
complete, causing a deadlock.
As a band-aid, restore the previous handshake protocol by not blocking
SIGSETXID during thread exit.
The new test sysdeps/pthread/tst-pthread-setuid-loop.c is based on
a downstream test by Martin Osvald.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 2849e2f53311b66853cb5159b64cba2bddbfb854)
---
NEWS | 1 +
nptl/pthread_create.c | 12 ++++-
sysdeps/pthread/Makefile | 1 +
sysdeps/pthread/tst-pthread-setuid-loop.c | 61 +++++++++++++++++++++++
4 files changed, 73 insertions(+), 2 deletions(-)
create mode 100644 sysdeps/pthread/tst-pthread-setuid-loop.c
Index: glibc-2.34/nptl/pthread_create.c
===================================================================
--- glibc-2.34.orig/nptl/pthread_create.c
+++ glibc-2.34/nptl/pthread_create.c
@@ -488,8 +488,16 @@ start_thread (void *arg)
/* This prevents sending a signal from this thread to itself during
its final stages. This must come after the exit call above
- because atexit handlers must not run with signals blocked. */
- __libc_signal_block_all (NULL);
+ because atexit handlers must not run with signals blocked.
+
+ Do not block SIGSETXID. The setxid handshake below expects the
+ signal to be delivered. (SIGSETXID cannot run application code,
+ nor does it use pthread_kill.) Reuse the pd->sigmask space for
+ computing the signal mask, to save stack space. */
+ __sigfillset (&pd->sigmask);
+ __sigdelset (&pd->sigmask, SIGSETXID);
+ INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &pd->sigmask, NULL,
+ __NSIG_BYTES);
/* Tell __pthread_kill_internal that this thread is about to exit.
If there is a __pthread_kill_internal in progress, this delays
Index: glibc-2.34/sysdeps/pthread/Makefile
===================================================================
--- glibc-2.34.orig/sysdeps/pthread/Makefile
+++ glibc-2.34/sysdeps/pthread/Makefile
@@ -118,6 +118,7 @@ tests += tst-cnd-basic tst-mtx-trylock t
tst-unload \
tst-unwind-thread \
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
+ tst-pthread-setuid-loop \
tst-pthread_cancel-select-loop \
tst-pthread_kill-exiting \
Index: glibc-2.34/sysdeps/pthread/tst-pthread-setuid-loop.c
===================================================================
--- /dev/null
+++ glibc-2.34/sysdeps/pthread/tst-pthread-setuid-loop.c
@@ -0,0 +1,61 @@
+/* Test that setuid, pthread_create, thread exit do not deadlock (bug 28361).
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/check.h>
+#include <support/xthread.h>
+#include <unistd.h>
+
+/* How many threads to launch during each iteration. */
+enum { threads = 4 };
+
+/* How many iterations to perform. This value seems to reproduce
+ bug 28361 in a bout one in three runs. */
+enum { iterations = 5000 };
+
+/* Cache of the real user ID used by setuid_thread. */
+static uid_t uid;
+
+/* Start routine for the threads. */
+static void *
+setuid_thread (void *closure)
+{
+ TEST_COMPARE (setuid (uid), 0);
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ /* The setxid machinery is still invoked even if the UID is
+ unchanged. (The kernel might reset other credentials as part of
+ the system call.) */
+ uid = getuid ();
+
+ for (int i = 0; i < iterations; ++i)
+ {
+ pthread_t thread_ids[threads];
+ for (int j = 0; j < threads; ++j)
+ thread_ids[j] = xpthread_create (NULL, setuid_thread, NULL);
+ for (int j = 0; j < threads; ++j)
+ xpthread_join (thread_ids[j]);
+ }
+
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -1,390 +0,0 @@
From 822662cf2a4b170ade4c5342f035d68815a03276 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon, 6 Sep 2021 14:19:51 -0300
Subject: [PATCH] linux: Revert the use of sched_getaffinity on get_nproc (BZ
#28310)
The use of sched_getaffinity on get_nproc and
sysconf (_SC_NPROCESSORS_ONLN) done in 903bc7dcc2acafc40 (BZ #27645)
breaks the top command in common hypervisor configurations and also
other monitoring tools.
The main issue using sched_getaffinity changed the symbols semantic
from system-wide scope of online CPUs to per-process one (which can
be changed with kernel cpusets or book parameters in VM).
This patch reverts mostly of the 903bc7dcc2acafc40, with the
exceptions:
* No more cached values and atomic updates, since they are inherent
racy.
* No /proc/cpuinfo fallback, since /proc/stat is already used and
it would require to revert more arch-specific code.
* The alloca is replace with a static buffer of 1024 bytes.
So the implementation first consult the sysfs, and fallbacks to procfs.
Checked on x86_64-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 342298278eabc75baabcaced110a11a02c3d3580)
Index: glibc-2.34/include/sys/sysinfo.h
===================================================================
--- glibc-2.34.orig/include/sys/sysinfo.h
+++ glibc-2.34/include/sys/sysinfo.h
@@ -9,10 +9,15 @@
extern int __get_nprocs_conf (void);
libc_hidden_proto (__get_nprocs_conf)
-/* Return number of available processors. */
+/* Return number of available processors (not all of them will be
+ available to the caller process). */
extern int __get_nprocs (void);
libc_hidden_proto (__get_nprocs)
+/* Return the number of available processors which the process can
+ be scheduled. */
+extern int __get_nprocs_sched (void) attribute_hidden;
+
/* Return number of physical pages of memory in the system. */
extern long int __get_phys_pages (void);
libc_hidden_proto (__get_phys_pages)
Index: glibc-2.34/malloc/arena.c
===================================================================
--- glibc-2.34.orig/malloc/arena.c
+++ glibc-2.34/malloc/arena.c
@@ -879,7 +879,7 @@ arena_get2 (size_t size, mstate avoid_ar
narenas_limit = mp_.arena_max;
else if (narenas > mp_.arena_test)
{
- int n = __get_nprocs ();
+ int n = __get_nprocs_sched ();
if (n >= 1)
narenas_limit = NARENAS_FROM_NCORES (n);
Index: glibc-2.34/misc/getsysstats.c
===================================================================
--- glibc-2.34.orig/misc/getsysstats.c
+++ glibc-2.34/misc/getsysstats.c
@@ -45,6 +45,12 @@ weak_alias (__get_nprocs, get_nprocs)
link_warning (get_nprocs, "warning: get_nprocs will always return 1")
+int
+__get_nprocs_sched (void)
+{
+ return 1;
+}
+
long int
__get_phys_pages (void)
{
Index: glibc-2.34/posix/Makefile
===================================================================
--- glibc-2.34.orig/posix/Makefile
+++ glibc-2.34/posix/Makefile
@@ -107,7 +107,8 @@ tests := test-errno tstgetopt testfnm r
tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
- tst-wordexp-nocmd tst-execveat tst-spawn5
+ tst-wordexp-nocmd tst-execveat tst-spawn5 \
+ tst-sched_getaffinity
# Test for the glob symbol version that was replaced in glibc 2.27.
ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
Index: glibc-2.34/posix/tst-sched_getaffinity.c
===================================================================
--- /dev/null
+++ glibc-2.34/posix/tst-sched_getaffinity.c
@@ -0,0 +1,48 @@
+/* Tests for sched_getaffinity with large buffers.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <array_length.h>
+#include <sched.h>
+#include <support/check.h>
+
+/* NB: this test may fail on system with more than 32k cpus. */
+
+static int
+do_test (void)
+{
+ /* The values are larger than the default cpu_set_t. */
+ const int bufsize[] = { 1<<11, 1<<12, 1<<13, 1<<14, 1<<15, 1<<16, 1<<17 };
+ int cpucount[array_length (bufsize)];
+
+ for (int i = 0; i < array_length (bufsize); i++)
+ {
+ cpu_set_t *cpuset = CPU_ALLOC (bufsize[i]);
+ TEST_VERIFY (cpuset != NULL);
+ size_t size = CPU_ALLOC_SIZE (bufsize[i]);
+ TEST_COMPARE (sched_getaffinity (0, size, cpuset), 0);
+ cpucount[i] = CPU_COUNT_S (size, cpuset);
+ CPU_FREE (cpuset);
+ }
+
+ for (int i = 0; i < array_length (cpucount) - 1; i++)
+ TEST_COMPARE (cpucount[i], cpucount[i + 1]);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
Index: glibc-2.34/sysdeps/mach/getsysstats.c
===================================================================
--- glibc-2.34.orig/sysdeps/mach/getsysstats.c
+++ glibc-2.34/sysdeps/mach/getsysstats.c
@@ -62,6 +62,12 @@ __get_nprocs (void)
libc_hidden_def (__get_nprocs)
weak_alias (__get_nprocs, get_nprocs)
+int
+__get_nprocs_sched (void)
+{
+ return __get_nprocs ();
+}
+
/* Return the number of physical pages on the system. */
long int
__get_phys_pages (void)
Index: glibc-2.34/sysdeps/unix/sysv/linux/getsysstats.c
===================================================================
--- glibc-2.34.orig/sysdeps/unix/sysv/linux/getsysstats.c
+++ glibc-2.34/sysdeps/unix/sysv/linux/getsysstats.c
@@ -18,6 +18,8 @@
<https://www.gnu.org/licenses/>. */
#include <array_length.h>
+#include <assert.h>
+#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <ldsodefs.h>
@@ -29,61 +31,162 @@
#include <sys/sysinfo.h>
#include <sysdep.h>
-/* Compute the population count of the entire array. */
-static int
-__get_nprocs_count (const unsigned long int *array, size_t length)
+int
+__get_nprocs_sched (void)
{
- int count = 0;
- for (size_t i = 0; i < length; ++i)
- if (__builtin_add_overflow (count, __builtin_popcountl (array[i]),
- &count))
- return INT_MAX;
- return count;
-}
+ enum
+ {
+ max_num_cpus = 32768,
+ cpu_bits_size = CPU_ALLOC_SIZE (32768)
+ };
-/* __get_nprocs with a large buffer. */
-static int
-__get_nprocs_large (void)
-{
- /* This code cannot use scratch_buffer because it is used during
- malloc initialization. */
- size_t pagesize = GLRO (dl_pagesize);
- unsigned long int *page = __mmap (0, pagesize, PROT_READ | PROT_WRITE,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- if (page == MAP_FAILED)
- return 2;
- int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, pagesize, page);
- int count;
+ /* This cannot use malloc because it is used on malloc initialization. */
+ __cpu_mask cpu_bits[cpu_bits_size / sizeof (__cpu_mask)];
+ int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
+ cpu_bits);
if (r > 0)
- count = __get_nprocs_count (page, pagesize / sizeof (unsigned long int));
+ return CPU_COUNT_S (cpu_bits_size, (cpu_set_t*) cpu_bits);
else if (r == -EINVAL)
- /* One page is still not enough to store the bits. A more-or-less
- arbitrary value. This assumes t hat such large systems never
- happen in practice. */
- count = GLRO (dl_pagesize) * CHAR_BIT;
- else
- count = 2;
- __munmap (page, GLRO (dl_pagesize));
- return count;
+ /* The input buffer is still not enough to store the number of cpus. This
+ is an arbitrary values assuming such systems should be rare and there
+ is no offline cpus. */
+ return max_num_cpus;
+ /* Some other error. 2 is conservative (not a uniprocessor system, so
+ atomics are needed). */
+ return 2;
}
+static char *
+next_line (int fd, char *const buffer, char **cp, char **re,
+ char *const buffer_end)
+{
+ char *res = *cp;
+ char *nl = memchr (*cp, '\n', *re - *cp);
+ if (nl == NULL)
+ {
+ if (*cp != buffer)
+ {
+ if (*re == buffer_end)
+ {
+ memmove (buffer, *cp, *re - *cp);
+ *re = buffer + (*re - *cp);
+ *cp = buffer;
+
+ ssize_t n = __read_nocancel (fd, *re, buffer_end - *re);
+ if (n < 0)
+ return NULL;
+
+ *re += n;
+
+ nl = memchr (*cp, '\n', *re - *cp);
+ while (nl == NULL && *re == buffer_end)
+ {
+ /* Truncate too long lines. */
+ *re = buffer + 3 * (buffer_end - buffer) / 4;
+ n = __read_nocancel (fd, *re, buffer_end - *re);
+ if (n < 0)
+ return NULL;
+
+ nl = memchr (*re, '\n', n);
+ **re = '\n';
+ *re += n;
+ }
+ }
+ else
+ nl = memchr (*cp, '\n', *re - *cp);
+
+ res = *cp;
+ }
+
+ if (nl == NULL)
+ nl = *re - 1;
+ }
+
+ *cp = nl + 1;
+ assert (*cp <= *re);
+
+ return res == *re ? NULL : res;
+}
+
+
int
__get_nprocs (void)
{
- /* Fast path for most systems. The kernel expects a buffer size
- that is a multiple of 8. */
- unsigned long int small_buffer[1024 / CHAR_BIT / sizeof (unsigned long int)];
- int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0,
- sizeof (small_buffer), small_buffer);
- if (r > 0)
- return __get_nprocs_count (small_buffer, r / sizeof (unsigned long int));
- else if (r == -EINVAL)
- /* The kernel requests a larger buffer to store the data. */
- return __get_nprocs_large ();
- else
- /* Some other error. 2 is conservative (not a uniprocessor
- system, so atomics are needed). */
- return 2;
+ enum { buffer_size = 1024 };
+ char buffer[buffer_size];
+ char *buffer_end = buffer + buffer_size;
+ char *cp = buffer_end;
+ char *re = buffer_end;
+
+ const int flags = O_RDONLY | O_CLOEXEC;
+ /* This file contains comma-separated ranges. */
+ int fd = __open_nocancel ("/sys/devices/system/cpu/online", flags);
+ char *l;
+ int result = 0;
+ if (fd != -1)
+ {
+ l = next_line (fd, buffer, &cp, &re, buffer_end);
+ if (l != NULL)
+ do
+ {
+ char *endp;
+ unsigned long int n = strtoul (l, &endp, 10);
+ if (l == endp)
+ {
+ result = 0;
+ break;
+ }
+
+ unsigned long int m = n;
+ if (*endp == '-')
+ {
+ l = endp + 1;
+ m = strtoul (l, &endp, 10);
+ if (l == endp)
+ {
+ result = 0;
+ break;
+ }
+ }
+
+ result += m - n + 1;
+
+ l = endp;
+ if (l < re && *l == ',')
+ ++l;
+ }
+ while (l < re && *l != '\n');
+
+ __close_nocancel_nostatus (fd);
+
+ if (result > 0)
+ return result;
+ }
+
+ cp = buffer_end;
+ re = buffer_end;
+
+ /* Default to an SMP system in case we cannot obtain an accurate
+ number. */
+ result = 2;
+
+ fd = __open_nocancel ("/proc/stat", flags);
+ if (fd != -1)
+ {
+ result = 0;
+
+ while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
+ /* The current format of /proc/stat has all the cpu* entries
+ at the front. We assume here that stays this way. */
+ if (strncmp (l, "cpu", 3) != 0)
+ break;
+ else if (isdigit (l[3]))
+ ++result;
+
+ __close_nocancel_nostatus (fd);
+ }
+
+ return result;
}
libc_hidden_def (__get_nprocs)
weak_alias (__get_nprocs, get_nprocs)

View File

@ -1,39 +0,0 @@
From f2413f2710d5d5cc884b413b83fcf8198e3717fa Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 28 Aug 2021 06:10:38 -0700
Subject: [PATCH] x86-64: Use testl to check __x86_string_control
Use testl, instead of andl, to check __x86_string_control to avoid
updating __x86_string_control.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 3c8b9879cab6d41787bc5b14c1748f62fd6d0e5f)
---
sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
index 9f02624375..abde8438d4 100644
--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
@@ -325,7 +325,7 @@ L(movsb):
/* Avoid slow backward REP MOVSB. */
jb L(more_8x_vec_backward)
# if AVOID_SHORT_DISTANCE_REP_MOVSB
- andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
+ testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
jz 3f
movq %rdi, %rcx
subq %rsi, %rcx
@@ -333,7 +333,7 @@ L(movsb):
# endif
1:
# if AVOID_SHORT_DISTANCE_REP_MOVSB
- andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
+ testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
jz 3f
movq %rsi, %rcx
subq %rdi, %rcx
--
2.33.0