SHA256
1
0
forked from pool/glibc
glibc/duplocale-global-locale.patch

58 lines
1.8 KiB
Diff
Raw Normal View History

- Update to glibc 2.40 * The <stdbit.h> header type-generic macros have been changed when using GCC 14.1 or later to use __builtin_stdc_bit_ceil etc. built-in functions * The GNU C Library now supports a feature test macro _ISOC23_SOURCE to enable features from the ISO C23 standard * The ISO C23 function families introduced in TS 18661-4:2015 are now supported in <math.h> * A new tunable, glibc.rtld.enable_secure, can be used to run a program as if it were a setuid process * On Linux, the epoll header was updated to include epoll ioctl definitions and the related structure added in Linux kernel 6.9 * The fortify functionality has been significantly enhanced for building programs with clang against the GNU C Library * Many functions have been added to the vector library for aarch64 * On x86, memset can now use non-temporal stores to improve the performance of large writes * Architectures which use a 32-bit seconds-since-epoch field in struct lastlog, struct utmp, struct utmpx (such as i386, powerpc64le, rv32, rv64, x86-64) switched from a signed to an unsigned type for that field * __rseq_size now denotes the size of the active rseq area (20 bytes initially), not the size of struct rseq (32 bytes initially). - arm-dl-start-user.patch, duplocale-global-locale.patch, elf-parse-tunables.patch, glibc-CVE-2024-33599-nscd-Stack-based-buffer-overflow-in-n.patch, glibc-CVE-2024-33600-nscd-Avoid-null-pointer-crashes-after.patch, glibc-CVE-2024-33600-nscd-Do-not-send-missing-not-found-re.patch, glibc-CVE-2024-33601-CVE-2024-33602-nscd-netgroup-Use-two.patch, iconv-iso-2022-cn-ext.patch, nscd-netgroup-cache-timeout.patch, s390-clone-error-clobber-r7.patch, sigisemptyset.patch, OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=719
2024-07-30 08:33:46 +00:00
From 513331b788a3fa633f1d0417d43915e16a0c88f0 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 6 Mar 2024 12:59:47 +0100
Subject: [PATCH] duplocale: protect use of global locale (bug 23970)
Protect the global locale from being modified while we compute the size of
the locale category names. That allows the use of the global locale in a
single thread, while all other threads use the thread safe locale
functions.
---
locale/duplocale.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/locale/duplocale.c b/locale/duplocale.c
index a755ac5c36..bad476700f 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -43,6 +43,11 @@ __duplocale (locale_t dataset)
int cnt;
size_t names_len = 0;
+ /* If dataset points to _nl_global_locale, we need to prevent other
+ threads from modifying it. We also modify global data below (the
+ usage counts). */
+ __libc_rwlock_wrlock (__libc_setlocale_lock);
+
/* Calculate the total space we need to store all the names. */
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL && dataset->__names[cnt] != _nl_C_name)
@@ -55,9 +60,6 @@ __duplocale (locale_t dataset)
{
char *namep = (char *) (result + 1);
- /* We modify global data (the usage counts). */
- __libc_rwlock_wrlock (__libc_setlocale_lock);
-
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL)
{
@@ -78,11 +80,11 @@ __duplocale (locale_t dataset)
result->__ctype_b = dataset->__ctype_b;
result->__ctype_tolower = dataset->__ctype_tolower;
result->__ctype_toupper = dataset->__ctype_toupper;
-
- /* It's done. */
- __libc_rwlock_unlock (__libc_setlocale_lock);
}
+ /* It's done. */
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+
return result;
}
weak_alias (__duplocale, duplocale)
--
2.44.0