Accepting request 1102128 from Base:System
- Update to glibc 2.38 * When C2X features are enabled and the base argument is 0 or 2, the following functions support binary integers prefixed by 0b or 0B as input * PRIb*, PRIB* and SCNb* macros from C2X have been added to <inttypes.h>. * printf-family functions now support the wN format length modifiers for arguments of type intN_t, int_leastN_t, uintN_t or uint_leastN_t and the wfN format length modifiers for arguments of type int_fastN_t or uint_fastN_t, as specified in draft ISO C2X * A new tunable, glibc.pthread.stack_hugetlb, can be used to disable Transparent Huge Pages (THP) in stack allocation at pthread_create * Vector math library libmvec support has been added to AArch64 * The strlcpy and strlcat functions have been added * CVE-2023-25139: When the printf family of functions is called with a format specifier that uses an <apostrophe> (enable grouping) and a minimum width specifier, the resulting output could be larger than reasonably expected by a caller that computed a tight bound on the buffer size - Enable build with _FORTIFY_SOURCE - glibc-2.3.90-langpackdir.diff: avoid reference to __strcpy_chk - iconv-error-verbosity.patch: iconv: restore verbosity with unrecognized encoding names (BZ #30694) - printf-grouping.patch, strftime-time64.patch, getlogin-no-loginuid.patch, fix-locking-in-_IO_cleanup.patch, gshadow-erange-rhandling.patch, system-sigchld-block.patch, gmon-buffer-alloc.patch, check-pf-cancel-handler.patch, powerpc64-fcntl-lock.patch, realloc-limit-chunk-reuse.patch, dl-find-object-return.patch; Removed (forwarded request 1102127 from Andreas_Schwab) OBS-URL: https://build.opensuse.org/request/show/1102128 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=277
This commit is contained in:
commit
09998423be
@ -1,85 +0,0 @@
|
||||
From f5d377c896b95fefc712b0fd5e5804ae3f48d392 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Thu, 27 Apr 2023 13:06:15 -0700
|
||||
Subject: [PATCH] __check_pf: Add a cancellation cleanup handler [BZ #20975]
|
||||
|
||||
There are reports for hang in __check_pf:
|
||||
|
||||
https://github.com/JoeDog/siege/issues/4
|
||||
|
||||
It is reproducible only under specific configurations:
|
||||
|
||||
1. Large number of cores (>= 64) and large number of threads (> 3X of
|
||||
the number of cores) with long lived socket connection.
|
||||
2. Low power (frequency) mode.
|
||||
3. Power management is enabled.
|
||||
|
||||
While holding lock, __check_pf calls make_request which calls __sendto
|
||||
and __recvmsg. Since __sendto and __recvmsg are cancellation points,
|
||||
lock held by __check_pf won't be released and can cause deadlock when
|
||||
thread cancellation happens in __sendto or __recvmsg. Add a cancellation
|
||||
cleanup handler for __check_pf to unlock the lock when cancelled by
|
||||
another thread. This fixes BZ #20975 and the siege hang issue.
|
||||
|
||||
(cherry picked from commit a443bd3fb233186038b8b483959ecb7978d1abea)
|
||||
---
|
||||
sysdeps/unix/sysv/linux/Makefile | 2 ++
|
||||
sysdeps/unix/sysv/linux/check_pf.c | 15 +++++++++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
|
||||
index f298878e8f..94747b37a6 100644
|
||||
--- a/sysdeps/unix/sysv/linux/Makefile
|
||||
+++ b/sysdeps/unix/sysv/linux/Makefile
|
||||
@@ -456,6 +456,8 @@ sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
|
||||
netrom/netrom.h netpacket/packet.h netrose/rose.h \
|
||||
neteconet/ec.h netiucv/iucv.h
|
||||
sysdep_routines += netlink_assert_response
|
||||
+
|
||||
+CFLAGS-check_pf.c += -fexceptions
|
||||
endif
|
||||
|
||||
# Don't compile the ctype glue code, since there is no old non-GNU C library.
|
||||
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
|
||||
index de207122b0..50654cb28d 100644
|
||||
--- a/sysdeps/unix/sysv/linux/check_pf.c
|
||||
+++ b/sysdeps/unix/sysv/linux/check_pf.c
|
||||
@@ -292,6 +292,14 @@ make_request (int fd, pid_t pid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#ifdef __EXCEPTIONS
|
||||
+static void
|
||||
+cancel_handler (void *arg __attribute__((unused)))
|
||||
+{
|
||||
+ /* Release the lock. */
|
||||
+ __libc_lock_unlock (lock);
|
||||
+}
|
||||
+#endif
|
||||
|
||||
void
|
||||
attribute_hidden
|
||||
@@ -304,6 +312,10 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
|
||||
struct cached_data *olddata = NULL;
|
||||
struct cached_data *data = NULL;
|
||||
|
||||
+#ifdef __EXCEPTIONS
|
||||
+ /* Make sure that lock is released when the thread is cancelled. */
|
||||
+ __libc_cleanup_push (cancel_handler, NULL);
|
||||
+#endif
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
if (cache_valid_p ())
|
||||
@@ -338,6 +350,9 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef __EXCEPTIONS
|
||||
+ __libc_cleanup_pop (0);
|
||||
+#endif
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
if (data != NULL)
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,60 +0,0 @@
|
||||
From 3f4b4e2cdd529266ea5a2c6c5e0c66bab81bfd0e Mon Sep 17 00:00:00 2001
|
||||
From: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri, 7 Jul 2023 10:11:26 +0200
|
||||
Subject: [PATCH] elf: _dl_find_object may return 1 during early startup (bug
|
||||
30515)
|
||||
|
||||
Success is reported with a 0 return value, and failure is -1.
|
||||
Enhance the kitchen sink test elf/tst-audit28 to cover
|
||||
_dl_find_object as well.
|
||||
|
||||
Fixes commit 5d28a8962dcb ("elf: Add _dl_find_object function")
|
||||
and bug 30515.
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 1bcfe0f732066ae5336b252295591ebe7e51c301)
|
||||
---
|
||||
NEWS | 1 +
|
||||
elf/dl-find_object.c | 2 +-
|
||||
elf/tst-auditmod28.c | 11 +++++++++++
|
||||
3 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/elf/dl-find_object.c b/elf/dl-find_object.c
|
||||
index 2ced2f3510..934e77e11f 100644
|
||||
--- a/elf/dl-find_object.c
|
||||
+++ b/elf/dl-find_object.c
|
||||
@@ -46,7 +46,7 @@ _dl_find_object_slow (void *pc, struct dl_find_object *result)
|
||||
struct dl_find_object_internal internal;
|
||||
_dl_find_object_from_map (l, &internal);
|
||||
_dl_find_object_to_external (&internal, result);
|
||||
- return 1;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* Object not found. */
|
||||
diff --git a/elf/tst-auditmod28.c b/elf/tst-auditmod28.c
|
||||
index f6ab991398..f6dfbbe202 100644
|
||||
--- a/elf/tst-auditmod28.c
|
||||
+++ b/elf/tst-auditmod28.c
|
||||
@@ -71,6 +71,17 @@ la_version (unsigned int current)
|
||||
TEST_VERIFY (dladdr1 (&_exit, &info, &extra_info, RTLD_DL_LINKMAP) != 0);
|
||||
TEST_VERIFY (extra_info == handle);
|
||||
|
||||
+ /* Check _dl_find_object. */
|
||||
+ struct dl_find_object dlfo;
|
||||
+ TEST_COMPARE (_dl_find_object (__builtin_return_address (0), &dlfo), 0);
|
||||
+ /* "ld.so" is seen with --enable-hardcoded-path-in-tests. */
|
||||
+ if (strcmp (basename (dlfo.dlfo_link_map->l_name), "ld.so") != 0)
|
||||
+ TEST_COMPARE_STRING (basename (dlfo.dlfo_link_map->l_name), LD_SO);
|
||||
+ TEST_COMPARE (_dl_find_object (dlsym (handle, "environ"), &dlfo), 0);
|
||||
+ TEST_COMPARE_STRING (basename (dlfo.dlfo_link_map->l_name), LIBC_SO);
|
||||
+ TEST_COMPARE (_dl_find_object ((void *) 1, &dlfo), -1);
|
||||
+ TEST_COMPARE (_dl_find_object ((void *) -1, &dlfo), -1);
|
||||
+
|
||||
/* Verify that dlmopen creates a new namespace. */
|
||||
void *dlmopen_handle = xdlmopen (LM_ID_NEWLM, LIBC_SO, RTLD_NOW);
|
||||
TEST_VERIFY (dlmopen_handle != handle);
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,233 +0,0 @@
|
||||
Always do locking when accessing streams (bug 15142, bug 14697)
|
||||
|
||||
Now that abort no longer calls fflush there is no reason to avoid locking
|
||||
the stdio streams anywhere. This fixes a conformance issue and potential
|
||||
heap corruption during exit.
|
||||
|
||||
Index: glibc-2.37/libio/genops.c
|
||||
===================================================================
|
||||
--- glibc-2.37.orig/libio/genops.c
|
||||
+++ glibc-2.37/libio/genops.c
|
||||
@@ -682,7 +682,7 @@ _IO_adjust_column (unsigned start, const
|
||||
libc_hidden_def (_IO_adjust_column)
|
||||
|
||||
int
|
||||
-_IO_flush_all_lockp (int do_lock)
|
||||
+_IO_flush_all (void)
|
||||
{
|
||||
int result = 0;
|
||||
FILE *fp;
|
||||
@@ -695,8 +695,7 @@ _IO_flush_all_lockp (int do_lock)
|
||||
for (fp = (FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
|
||||
{
|
||||
run_fp = fp;
|
||||
- if (do_lock)
|
||||
- _IO_flockfile (fp);
|
||||
+ _IO_flockfile (fp);
|
||||
|
||||
if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
|| (_IO_vtable_offset (fp) == 0
|
||||
@@ -706,8 +705,7 @@ _IO_flush_all_lockp (int do_lock)
|
||||
&& _IO_OVERFLOW (fp, EOF) == EOF)
|
||||
result = EOF;
|
||||
|
||||
- if (do_lock)
|
||||
- _IO_funlockfile (fp);
|
||||
+ _IO_funlockfile (fp);
|
||||
run_fp = NULL;
|
||||
}
|
||||
|
||||
@@ -718,14 +716,6 @@ _IO_flush_all_lockp (int do_lock)
|
||||
|
||||
return result;
|
||||
}
|
||||
-
|
||||
-
|
||||
-int
|
||||
-_IO_flush_all (void)
|
||||
-{
|
||||
- /* We want locking. */
|
||||
- return _IO_flush_all_lockp (1);
|
||||
-}
|
||||
libc_hidden_def (_IO_flush_all)
|
||||
|
||||
void
|
||||
@@ -791,6 +781,9 @@ _IO_unbuffer_all (void)
|
||||
{
|
||||
int legacy = 0;
|
||||
|
||||
+ run_fp = fp;
|
||||
+ _IO_flockfile (fp);
|
||||
+
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||
if (__glibc_unlikely (_IO_vtable_offset (fp) != 0))
|
||||
legacy = 1;
|
||||
@@ -800,18 +793,6 @@ _IO_unbuffer_all (void)
|
||||
/* Iff stream is un-orientated, it wasn't used. */
|
||||
&& (legacy || fp->_mode != 0))
|
||||
{
|
||||
-#ifdef _IO_MTSAFE_IO
|
||||
- int cnt;
|
||||
-#define MAXTRIES 2
|
||||
- for (cnt = 0; cnt < MAXTRIES; ++cnt)
|
||||
- if (fp->_lock == NULL || _IO_lock_trylock (*fp->_lock) == 0)
|
||||
- break;
|
||||
- else
|
||||
- /* Give the other thread time to finish up its use of the
|
||||
- stream. */
|
||||
- __sched_yield ();
|
||||
-#endif
|
||||
-
|
||||
if (! legacy && ! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
|
||||
{
|
||||
fp->_flags |= _IO_USER_BUF;
|
||||
@@ -825,17 +806,15 @@ _IO_unbuffer_all (void)
|
||||
|
||||
if (! legacy && fp->_mode > 0)
|
||||
_IO_wsetb (fp, NULL, NULL, 0);
|
||||
-
|
||||
-#ifdef _IO_MTSAFE_IO
|
||||
- if (cnt < MAXTRIES && fp->_lock != NULL)
|
||||
- _IO_lock_unlock (*fp->_lock);
|
||||
-#endif
|
||||
}
|
||||
|
||||
/* Make sure that never again the wide char functions can be
|
||||
used. */
|
||||
if (! legacy)
|
||||
fp->_mode = -1;
|
||||
+
|
||||
+ _IO_funlockfile (fp);
|
||||
+ run_fp = NULL;
|
||||
}
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
@@ -861,9 +840,7 @@ libc_freeres_fn (buffer_free)
|
||||
int
|
||||
_IO_cleanup (void)
|
||||
{
|
||||
- /* We do *not* want locking. Some threads might use streams but
|
||||
- that is their problem, we flush them underneath them. */
|
||||
- int result = _IO_flush_all_lockp (0);
|
||||
+ int result = _IO_flush_all ();
|
||||
|
||||
/* We currently don't have a reliable mechanism for making sure that
|
||||
C++ static destructors are executed in the correct order.
|
||||
Index: glibc-2.37/libio/libioP.h
|
||||
===================================================================
|
||||
--- glibc-2.37.orig/libio/libioP.h
|
||||
+++ glibc-2.37/libio/libioP.h
|
||||
@@ -488,7 +488,6 @@ extern int _IO_new_do_write (FILE *, con
|
||||
extern int _IO_old_do_write (FILE *, const char *, size_t);
|
||||
extern int _IO_wdo_write (FILE *, const wchar_t *, size_t);
|
||||
libc_hidden_proto (_IO_wdo_write)
|
||||
-extern int _IO_flush_all_lockp (int);
|
||||
extern int _IO_flush_all (void);
|
||||
libc_hidden_proto (_IO_flush_all)
|
||||
extern int _IO_cleanup (void);
|
||||
Index: glibc-2.37/support/delayed_exit.c
|
||||
===================================================================
|
||||
--- glibc-2.37.orig/support/delayed_exit.c
|
||||
+++ glibc-2.37/support/delayed_exit.c
|
||||
@@ -23,33 +23,58 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
#include <time.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+struct delayed_exit_request
|
||||
+{
|
||||
+ void (*exitfunc) (int);
|
||||
+ int seconds;
|
||||
+};
|
||||
|
||||
static void *
|
||||
-delayed_exit_thread (void *seconds_as_ptr)
|
||||
+delayed_exit_thread (void *closure)
|
||||
{
|
||||
- int seconds = (uintptr_t) seconds_as_ptr;
|
||||
- struct timespec delay = { seconds, 0 };
|
||||
+ struct delayed_exit_request *request = closure;
|
||||
+ void (*exitfunc) (int) = request->exitfunc;
|
||||
+ struct timespec delay = { request->seconds, 0 };
|
||||
struct timespec remaining = { 0 };
|
||||
+ free (request);
|
||||
+
|
||||
if (nanosleep (&delay, &remaining) != 0)
|
||||
FAIL_EXIT1 ("nanosleep: %m");
|
||||
/* Exit the process sucessfully. */
|
||||
- exit (0);
|
||||
+ exitfunc (0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-void
|
||||
-delayed_exit (int seconds)
|
||||
+static void
|
||||
+delayed_exit_1 (int seconds, void (*exitfunc) (int))
|
||||
{
|
||||
/* Create the new thread with all signals blocked. */
|
||||
sigset_t all_blocked;
|
||||
sigfillset (&all_blocked);
|
||||
sigset_t old_set;
|
||||
xpthread_sigmask (SIG_SETMASK, &all_blocked, &old_set);
|
||||
+ struct delayed_exit_request *request = xmalloc (sizeof (*request));
|
||||
+ request->seconds = seconds;
|
||||
+ request->exitfunc = exitfunc;
|
||||
/* Create a detached thread. */
|
||||
- pthread_t thr = xpthread_create
|
||||
- (NULL, delayed_exit_thread, (void *) (uintptr_t) seconds);
|
||||
+ pthread_t thr = xpthread_create (NULL, delayed_exit_thread, request);
|
||||
xpthread_detach (thr);
|
||||
/* Restore the original signal mask. */
|
||||
xpthread_sigmask (SIG_SETMASK, &old_set, NULL);
|
||||
}
|
||||
+
|
||||
+void
|
||||
+delayed_exit (int seconds)
|
||||
+{
|
||||
+ delayed_exit_1 (seconds, exit);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+delayed__exit (int seconds)
|
||||
+{
|
||||
+ delayed_exit_1 (seconds, _exit);
|
||||
+}
|
||||
Index: glibc-2.37/support/xthread.h
|
||||
===================================================================
|
||||
--- glibc-2.37.orig/support/xthread.h
|
||||
+++ glibc-2.37/support/xthread.h
|
||||
@@ -25,11 +25,14 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
-/* Terminate the process (with exit status 0) after SECONDS have
|
||||
- elapsed, from a helper thread. The process is terminated with the
|
||||
- exit function, so atexit handlers are executed. */
|
||||
+/* Terminate the process (with exit (0)) after SECONDS have elapsed,
|
||||
+ from a helper thread. The process is terminated with the exit
|
||||
+ function, so atexit handlers are executed. */
|
||||
void delayed_exit (int seconds);
|
||||
|
||||
+/* Like delayed_exit, but use _exit (0). */
|
||||
+void delayed__exit (int seconds);
|
||||
+
|
||||
/* Returns true if Priority Inheritance support CLOCK_MONOTONIC. */
|
||||
bool support_mutex_pi_monotonic (void);
|
||||
|
||||
Index: glibc-2.37/sysdeps/pthread/tst-stdio1.c
|
||||
===================================================================
|
||||
--- glibc-2.37.orig/sysdeps/pthread/tst-stdio1.c
|
||||
+++ glibc-2.37/sysdeps/pthread/tst-stdio1.c
|
||||
@@ -46,7 +46,7 @@ do_test (void)
|
||||
_exit (1);
|
||||
}
|
||||
|
||||
- delayed_exit (1);
|
||||
+ delayed__exit (1);
|
||||
xpthread_join (th);
|
||||
|
||||
puts ("join returned");
|
@ -1,31 +0,0 @@
|
||||
From 0d83b349fa7340475406b2fe933c7467e4584091 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Wed, 15 Mar 2023 11:44:24 +0100
|
||||
Subject: [PATCH] getlogin_r: fix missing fallback if loginuid is unset (bug
|
||||
30235)
|
||||
|
||||
When /proc/self/loginuid is not set, we should still fall back to using
|
||||
the traditional utmp lookup, instead of failing right away.
|
||||
---
|
||||
sysdeps/unix/sysv/linux/getlogin_r.c | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
index 879df85a16..4ae9a53503 100644
|
||||
--- a/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
+++ b/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
@@ -59,10 +59,7 @@ __getlogin_r_loginuid (char *name, size_t namesize)
|
||||
value of, (uid_t) -1, so check if that value is set and return early to
|
||||
avoid making unneeded nss lookups. */
|
||||
if (uid == (uid_t) -1)
|
||||
- {
|
||||
- __set_errno (ENXIO);
|
||||
- return ENXIO;
|
||||
- }
|
||||
+ return -1;
|
||||
|
||||
struct passwd pwd;
|
||||
struct passwd *tpwd;
|
||||
--
|
||||
2.40.0
|
||||
|
@ -1,8 +1,8 @@
|
||||
Index: glibc-2.27/intl/loadmsgcat.c
|
||||
Index: glibc-2.38/intl/loadmsgcat.c
|
||||
===================================================================
|
||||
--- glibc-2.27.orig/intl/loadmsgcat.c
|
||||
+++ glibc-2.27/intl/loadmsgcat.c
|
||||
@@ -796,8 +796,27 @@ _nl_load_domain (struct loaded_l10nfile
|
||||
--- glibc-2.38.orig/intl/loadmsgcat.c
|
||||
+++ glibc-2.38/intl/loadmsgcat.c
|
||||
@@ -796,8 +796,26 @@ _nl_load_domain (struct loaded_l10nfile
|
||||
if (domain_file->filename == NULL)
|
||||
goto out;
|
||||
|
||||
@ -10,15 +10,14 @@ Index: glibc-2.27/intl/loadmsgcat.c
|
||||
- fd = open (domain_file->filename, O_RDONLY | O_BINARY);
|
||||
+ /* Replace /locale/ with /usr/share/locale-langpack/ */
|
||||
+ const char *langpackdir = "/usr/share/locale-langpack/";
|
||||
+ char *filename_langpack = malloc (strlen (domain_file->filename) +
|
||||
+ strlen (langpackdir));
|
||||
+ char *filename_langpack = malloc (strlen (domain_file->filename)
|
||||
+ + strlen (langpackdir));
|
||||
+ if (filename_langpack != NULL)
|
||||
+ {
|
||||
+ char *p = strstr (domain_file->filename, "/locale/");
|
||||
+ if (p != NULL)
|
||||
+ {
|
||||
+ strcpy (filename_langpack, langpackdir);
|
||||
+ strcpy (&filename_langpack[strlen (langpackdir)], p + 8);
|
||||
+ strcpy (__stpcpy (filename_langpack, langpackdir), p + 8);
|
||||
+ fd = open (filename_langpack, O_RDONLY | O_BINARY);
|
||||
+ }
|
||||
+
|
||||
|
BIN
glibc-2.37.tar.xz
(Stored with Git LFS)
BIN
glibc-2.37.tar.xz
(Stored with Git LFS)
Binary file not shown.
@ -1,16 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEcnNUKzmWLfeymZMUFnkrTqJTQPgFAmPbDiYACgkQFnkrTqJT
|
||||
QPhzuA/7B6Ct1UCXS/0t2KnjRpsbeMRsaq7Of+t3lAfOYdU3TcBNpPsFoSUFmf0m
|
||||
s6S92zlvYMkoHobEIOhKZsu1+RQwdAZidCvNy7YTsXGUypP0J4vRnOKYdsDG3JBp
|
||||
YQIj5ra90aTDrF/DDSmmWXkPnAEXUKaliMcllvaWdnQwsXfg8lPwd80kcerWHq7d
|
||||
4HtSdhTN5ELuVe6WunqLDqv1mA2vdOe6pzf6/ZWcr0JywcKFsI3mstbU42djAN/8
|
||||
dLm28tQCGnif5CcG1M+ljQ94bnbeYP9K5Tq7swQm6W4KN+UFmz3GWcQiKYk2Khra
|
||||
KjAHHwOyEcFPtwlm4ghMYNjrE0lTjPu9wGKxKGhnhKc+wnxflw2p81tdR6WGTJow
|
||||
gQdWDtsg3m5JdFoqsj2jIGoeSMuOJhjeg7xLH9+4Fpjl5lVQUHmomygVZO0Hd4dJ
|
||||
JRqyGYUecHM8odSN+45DqDBcaRu9UJihXKf5YxrFhnDckjgKTfl7t8OzC1Tgzyac
|
||||
tCFsvNi8JUYPpcWFrcyUEzYCsbdRrH/V+73d2c7ghIrq1LDCLU25ThPLVKB7yxg+
|
||||
yfv0IgOOgCox8anSZnEKV91HOlM4dUu7LEjL669Ww6MMZnHU0mAVaqJJyPWqVzz0
|
||||
i/K+9amzjNMW9/BfzvLMmmcqj91foGXdWcqVxrrAZuGKPXXSxaE=
|
||||
=guFd
|
||||
-----END PGP SIGNATURE-----
|
BIN
glibc-2.38.tar.xz
(Stored with Git LFS)
Normal file
BIN
glibc-2.38.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
16
glibc-2.38.tar.xz.sig
Normal file
16
glibc-2.38.tar.xz.sig
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEcnNUKzmWLfeymZMUFnkrTqJTQPgFAmTIKMsACgkQFnkrTqJT
|
||||
QPjMfg/9H6zpos/vnQnpMWKn/+eItqjJEgAJ4mSga2ncG+GugnuRMcR7BRjxrr8l
|
||||
pEi9v9lKEHojUv0CvLjuZn0yR+rhApABqRmP+E65ECxEgYRsTweSnvGtn2OlJcYe
|
||||
hVO2KDLKyiX5AbwXPSSZjYQpHpnO5Hcx5xnDlefLOOONHfut9LMbDuFpnbxXoPbm
|
||||
cbuar0JAX9QxS8JVAj77gFYuyTgrVAApPv8GlLRDnOhaQks1/EP63kKMnm1tLx5n
|
||||
HCZM6su0yVdT7gRLkyBeG12AhYa9zAXfEZZAZxDfpm9oHF7IoIC+uNP+1aH+K6Uy
|
||||
NYKpIqvDDlkOSuZEazOjzHDQEWOTRBHo1hkrRjj8XNAejazfYB363qBChWP8MCvo
|
||||
mqRkj88rmLVO+7RKvRasJGoMhJMkPqxdkwLMeB8EYfUgFt6eEul0hBZ1f533GoB8
|
||||
h6G3fFiPodY5X2o5Kyj6BTruxIs+US96PgERagw/RcL6kis2qI5RYJHzkliInp9i
|
||||
41MXx/hpw0vv3jX2b7mboYhMt+Ii+67B+mu9J4mOvXjfVo5lIf9k0FlnhKNhBRm4
|
||||
x4X6PgZSc2VLQNXStMBbG5A7vShAeqd0icDIrWdNDOwp+4M1C2LqCttc61xRE5hX
|
||||
00cL3f6r6vVbGp4PeYwN9LRlJdnK0cB5AS8dugmETP9qfYSDRyg=
|
||||
=G5Md
|
||||
-----END PGP SIGNATURE-----
|
@ -1,3 +1,37 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 2 10:50:32 UTC 2023 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
- Update to glibc 2.38
|
||||
* When C2X features are enabled and the base argument is 0 or 2, the
|
||||
following functions support binary integers prefixed by 0b or 0B as
|
||||
input
|
||||
* PRIb*, PRIB* and SCNb* macros from C2X have been added to
|
||||
<inttypes.h>.
|
||||
* printf-family functions now support the wN format length modifiers for
|
||||
arguments of type intN_t, int_leastN_t, uintN_t or uint_leastN_t
|
||||
and the wfN format
|
||||
length modifiers for arguments of type int_fastN_t or uint_fastN_t, as
|
||||
specified in draft ISO C2X
|
||||
* A new tunable, glibc.pthread.stack_hugetlb, can be used to disable
|
||||
Transparent Huge Pages (THP) in stack allocation at pthread_create
|
||||
* Vector math library libmvec support has been added to AArch64
|
||||
* The strlcpy and strlcat functions have been added
|
||||
* CVE-2023-25139: When the printf family of functions is called with a
|
||||
format specifier that uses an <apostrophe> (enable grouping) and a
|
||||
minimum width specifier, the resulting output could be larger than
|
||||
reasonably expected by a caller that computed a tight bound on the
|
||||
buffer size
|
||||
- Enable build with _FORTIFY_SOURCE
|
||||
- glibc-2.3.90-langpackdir.diff: avoid reference to __strcpy_chk
|
||||
- iconv-error-verbosity.patch: iconv: restore verbosity with unrecognized
|
||||
encoding names (BZ #30694)
|
||||
- printf-grouping.patch, strftime-time64.patch,
|
||||
getlogin-no-loginuid.patch, fix-locking-in-_IO_cleanup.patch,
|
||||
gshadow-erange-rhandling.patch, system-sigchld-block.patch,
|
||||
gmon-buffer-alloc.patch, check-pf-cancel-handler.patch,
|
||||
powerpc64-fcntl-lock.patch, realloc-limit-chunk-reuse.patch,
|
||||
dl-find-object-return.patch; Removed
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 10 08:46:18 UTC 2023 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
|
52
glibc.spec
52
glibc.spec
@ -49,7 +49,7 @@
|
||||
%bcond_with usrmerged
|
||||
%endif
|
||||
|
||||
%if %{gcc_version} < 12
|
||||
%if 0%{?gcc_version} < 12
|
||||
%define with_gcc 12
|
||||
%endif
|
||||
|
||||
@ -141,10 +141,10 @@ Name: glibc%{name_suffix}
|
||||
Summary: Standard Shared Libraries (from the GNU C Library)
|
||||
License: GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0
|
||||
Group: System/Libraries
|
||||
Version: 2.37
|
||||
Version: 2.38
|
||||
Release: 0
|
||||
%if %{without snapshot}
|
||||
%define git_id a704fd9a13
|
||||
%define git_id 36f2487f13
|
||||
%define libversion %version
|
||||
%else
|
||||
%define git_id %(echo %version | sed 's/.*\.g//')
|
||||
@ -289,28 +289,8 @@ Patch306: glibc-fix-double-loopback.diff
|
||||
###
|
||||
# Patches from upstream
|
||||
###
|
||||
# PATCH-FIX-UPSTREAM Account for grouping in printf width (BZ #30068)
|
||||
Patch1000: printf-grouping.patch
|
||||
# PATCH-FIX-UPSTREAM Use 64-bit time_t interfaces in strftime and strptime (BZ #30053)
|
||||
Patch1001: strftime-time64.patch
|
||||
# PATCH-FIX-UPSTREAM getlogin_r: fix missing fallback if loginuid is unset (BZ #30235)
|
||||
Patch1002: getlogin-no-loginuid.patch
|
||||
# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142)
|
||||
Patch1003: fix-locking-in-_IO_cleanup.patch
|
||||
# PATCH-FIX-UPSTREAM gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (BZ #30151)
|
||||
Patch1004: gshadow-erange-rhandling.patch
|
||||
# PATCH-FIX-UPSTREAM posix: Fix system blocks SIGCHLD erroneously (BZ #30163)
|
||||
Patch1005: system-sigchld-block.patch
|
||||
# PATCH-FIX-UPSTREAM gmon: Fix allocated buffer overflow (BZ #29444)
|
||||
Patch1006: gmon-buffer-alloc.patch
|
||||
# PATCH-FIX-UPSTREAM __check_pf: Add a cancellation cleanup handler (BZ #20975)
|
||||
Patch1007: check-pf-cancel-handler.patch
|
||||
# PATCH-FIX-UPSTREAM io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64
|
||||
Patch1008: powerpc64-fcntl-lock.patch
|
||||
# PATCH-FIX-UPSTREAM realloc: Limit chunk reuse to only growing requests (BZ #30579)
|
||||
Patch1009: realloc-limit-chunk-reuse.patch
|
||||
# PATCH-FIX-UPSTREAM elf: _dl_find_object may return 1 during early startup (BZ #30515)
|
||||
Patch1010: dl-find-object-return.patch
|
||||
# PATCH-FIX-OPENSUSE iconv: restore verbosity with unrecognized encoding names (BZ #30694)
|
||||
Patch1000: iconv-error-verbosity.patch
|
||||
|
||||
###
|
||||
# Patches awaiting upstream approval
|
||||
@ -535,16 +515,6 @@ library in a cross compilation setting.
|
||||
|
||||
%if %{without snapshot}
|
||||
%patch1000 -p1
|
||||
%patch1001 -p1
|
||||
%patch1002 -p1
|
||||
%patch1003 -p1
|
||||
%patch1004 -p1
|
||||
%patch1005 -p1
|
||||
%patch1006 -p1
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%patch1009 -p1
|
||||
%patch1010 -p1
|
||||
%endif
|
||||
|
||||
%patch2000 -p1
|
||||
@ -594,6 +564,7 @@ for opt in $tmp; do
|
||||
case $opt in
|
||||
-fstack-protector-*) enable_stack_protector=${opt#-fstack-protector-} ;;
|
||||
-fstack-protector) enable_stack_protector=yes ;;
|
||||
-D_FORTIFY_SOURCE=*) enable_fortify_source=${opt#-D_FORTIFY_SOURCE=} ;;
|
||||
-ffortify=* | *_FORTIFY_SOURCE*) ;;
|
||||
%if "%flavor" == "i686"
|
||||
*i586*) BuildFlags+=" ${opt/i586/i686}" ;;
|
||||
@ -707,6 +678,9 @@ profile="--disable-profile"
|
||||
--enable-stackguard-randomization \
|
||||
%endif
|
||||
${enable_stack_protector:+--enable-stack-protector=$enable_stack_protector} \
|
||||
%if !%{build_cross}
|
||||
${enable_fortify_source:+--enable-fortify-source=$enable_fortify_source} \
|
||||
%endif
|
||||
--enable-tunables \
|
||||
--enable-kernel=%{enablekernel} \
|
||||
--with-bugurl=http://bugs.opensuse.org \
|
||||
@ -1235,7 +1209,7 @@ exit 0
|
||||
%{slibdir}/libc_malloc_debug.so.0
|
||||
%{slibdir}/libdl.so.2*
|
||||
%{slibdir}/libm.so.6*
|
||||
%ifarch x86_64
|
||||
%ifarch x86_64 aarch64
|
||||
%{slibdir}/libmvec.so.1
|
||||
%endif
|
||||
%{slibdir}/libnsl.so.1
|
||||
@ -1297,7 +1271,7 @@ exit 0
|
||||
%{_libdir}/libc.so
|
||||
%{_libdir}/libc_malloc_debug.so
|
||||
%{_libdir}/libm.so
|
||||
%ifarch x86_64
|
||||
%ifarch x86_64 aarch64
|
||||
%{_libdir}/libmvec.so
|
||||
%endif
|
||||
%{_libdir}/libnss_compat.so
|
||||
@ -1324,7 +1298,7 @@ exit 0
|
||||
%{_libdir}/libanl.a
|
||||
%{_libdir}/libc.a
|
||||
%{_libdir}/libm.a
|
||||
%ifarch x86_64
|
||||
%ifarch x86_64 aarch64
|
||||
%{_libdir}/libm-%{libversion}.a
|
||||
%{_libdir}/libmvec.a
|
||||
%endif
|
||||
@ -1375,7 +1349,7 @@ exit 0
|
||||
%{_libdir}/libBrokenLocale_p.a
|
||||
%{_libdir}/libanl_p.a
|
||||
%{_libdir}/libm_p.a
|
||||
%ifarch x86_64
|
||||
%ifarch x86_64 aarch64
|
||||
%{_libdir}/libmvec_p.a
|
||||
%endif
|
||||
%{_libdir}/libpthread_p.a
|
||||
|
@ -1,79 +0,0 @@
|
||||
From 801af9fafd4689337ebf27260aa115335a0cb2bc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?=
|
||||
=?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= <leo@yuriev.ru>
|
||||
Date: Sat, 4 Feb 2023 14:41:38 +0300
|
||||
Subject: [PATCH] gmon: Fix allocated buffer overflow (bug 29444)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The `__monstartup()` allocates a buffer used to store all the data
|
||||
accumulated by the monitor.
|
||||
|
||||
The size of this buffer depends on the size of the internal structures
|
||||
used and the address range for which the monitor is activated, as well
|
||||
as on the maximum density of call instructions and/or callable functions
|
||||
that could be potentially on a segment of executable code.
|
||||
|
||||
In particular a hash table of arcs is placed at the end of this buffer.
|
||||
The size of this hash table is calculated in bytes as
|
||||
p->fromssize = p->textsize / HASHFRACTION;
|
||||
|
||||
but actually should be
|
||||
p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
|
||||
This results in writing beyond the end of the allocated buffer when an
|
||||
added arc corresponds to a call near from the end of the monitored
|
||||
address range, since `_mcount()` check the incoming caller address for
|
||||
monitored range but not the intermediate result hash-like index that
|
||||
uses to write into the table.
|
||||
|
||||
It should be noted that when the results are output to `gmon.out`, the
|
||||
table is read to the last element calculated from the allocated size in
|
||||
bytes, so the arcs stored outside the buffer boundary did not fall into
|
||||
`gprof` for analysis. Thus this "feature" help me to found this bug
|
||||
during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438
|
||||
|
||||
Just in case, I will explicitly note that the problem breaks the
|
||||
`make test t=gmon/tst-gmon-dso` added for Bug 29438.
|
||||
There, the arc of the `f3()` call disappears from the output, since in
|
||||
the DSO case, the call to `f3` is located close to the end of the
|
||||
monitored range.
|
||||
|
||||
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
|
||||
|
||||
Another minor error seems a related typo in the calculation of
|
||||
`kcountsize`, but since kcounts are smaller than froms, this is
|
||||
actually to align the p->froms data.
|
||||
|
||||
Co-authored-by: DJ Delorie <dj@redhat.com>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
---
|
||||
gmon/gmon.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gmon/gmon.c b/gmon/gmon.c
|
||||
index dee64803ad..bf76358d5b 100644
|
||||
--- a/gmon/gmon.c
|
||||
+++ b/gmon/gmon.c
|
||||
@@ -132,6 +132,8 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->textsize = p->highpc - p->lowpc;
|
||||
+ /* This looks like a typo, but it's here to align the p->froms
|
||||
+ section. */
|
||||
p->kcountsize = ROUNDUP(p->textsize / HISTFRACTION, sizeof(*p->froms));
|
||||
p->hashfraction = HASHFRACTION;
|
||||
p->log_hashfraction = -1;
|
||||
@@ -142,7 +144,7 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
instead of integer division. Precompute shift amount. */
|
||||
p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
|
||||
}
|
||||
- p->fromssize = p->textsize / HASHFRACTION;
|
||||
+ p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
p->tolimit = p->textsize * ARCDENSITY / 100;
|
||||
if (p->tolimit < MINARCS)
|
||||
p->tolimit = MINARCS;
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,130 +0,0 @@
|
||||
From 969e9733c7d17edf1e239a73fa172f357561f440 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Tue, 21 Feb 2023 09:20:28 +0100
|
||||
Subject: [PATCH] gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug
|
||||
30151)
|
||||
|
||||
Before this change, sgetsgent_r did not set errno to ERANGE, but
|
||||
sgetsgent only check errno, not the return value from sgetsgent_r.
|
||||
Consequently, sgetsgent did not detect any error, and reported
|
||||
success to the caller, without initializing the struct sgrp object
|
||||
whose address was returned.
|
||||
|
||||
This commit changes sgetsgent_r to set errno as well. This avoids
|
||||
similar issues in applications which only change errno.
|
||||
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
---
|
||||
gshadow/Makefile | 2 +-
|
||||
gshadow/sgetsgent_r.c | 5 ++-
|
||||
gshadow/tst-sgetsgent.c | 69 +++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 74 insertions(+), 2 deletions(-)
|
||||
create mode 100644 gshadow/tst-sgetsgent.c
|
||||
|
||||
diff --git a/gshadow/Makefile b/gshadow/Makefile
|
||||
index 796fbbf473..a95524593a 100644
|
||||
--- a/gshadow/Makefile
|
||||
+++ b/gshadow/Makefile
|
||||
@@ -26,7 +26,7 @@ headers = gshadow.h
|
||||
routines = getsgent getsgnam sgetsgent fgetsgent putsgent \
|
||||
getsgent_r getsgnam_r sgetsgent_r fgetsgent_r
|
||||
|
||||
-tests = tst-gshadow tst-putsgent tst-fgetsgent_r
|
||||
+tests = tst-gshadow tst-putsgent tst-fgetsgent_r tst-sgetsgent
|
||||
|
||||
CFLAGS-getsgent_r.c += -fexceptions
|
||||
CFLAGS-getsgent.c += -fexceptions
|
||||
diff --git a/gshadow/sgetsgent_r.c b/gshadow/sgetsgent_r.c
|
||||
index ea085e91d7..c75624e1f7 100644
|
||||
--- a/gshadow/sgetsgent_r.c
|
||||
+++ b/gshadow/sgetsgent_r.c
|
||||
@@ -61,7 +61,10 @@ __sgetsgent_r (const char *string, struct sgrp *resbuf, char *buffer,
|
||||
buffer[buflen - 1] = '\0';
|
||||
sp = strncpy (buffer, string, buflen);
|
||||
if (buffer[buflen - 1] != '\0')
|
||||
- return ERANGE;
|
||||
+ {
|
||||
+ __set_errno (ERANGE);
|
||||
+ return ERANGE;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
sp = (char *) string;
|
||||
diff --git a/gshadow/tst-sgetsgent.c b/gshadow/tst-sgetsgent.c
|
||||
new file mode 100644
|
||||
index 0000000000..0370c10fd0
|
||||
--- /dev/null
|
||||
+++ b/gshadow/tst-sgetsgent.c
|
||||
@@ -0,0 +1,69 @@
|
||||
+/* Test large input for sgetsgent (bug 30151).
|
||||
+ Copyright (C) 2023 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 <gshadow.h>
|
||||
+#include <stddef.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
+#include <support/xmemstream.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ /* Create a shadow group with 1000 members. */
|
||||
+ struct xmemstream mem;
|
||||
+ xopen_memstream (&mem);
|
||||
+ const char *passwd = "k+zD0nucwfxAo3sw1NXUj6K5vt5M16+X0TVGdE1uFvq5R8V7efJ";
|
||||
+ fprintf (mem.out, "group-name:%s::m0", passwd);
|
||||
+ for (int i = 1; i < 1000; ++i)
|
||||
+ fprintf (mem.out, ",m%d", i);
|
||||
+ xfclose_memstream (&mem);
|
||||
+
|
||||
+ /* Call sgetsgent. */
|
||||
+ char *input = mem.buffer;
|
||||
+ struct sgrp *e = sgetsgent (input);
|
||||
+ TEST_VERIFY_EXIT (e != NULL);
|
||||
+ TEST_COMPARE_STRING (e->sg_namp, "group-name");
|
||||
+ TEST_COMPARE_STRING (e->sg_passwd, passwd);
|
||||
+ /* No administrators. */
|
||||
+ TEST_COMPARE_STRING (e->sg_adm[0], NULL);
|
||||
+ /* Check the members list. */
|
||||
+ for (int i = 0; i < 1000; ++i)
|
||||
+ {
|
||||
+ char *member = xasprintf ("m%d", i);
|
||||
+ TEST_COMPARE_STRING (e->sg_mem[i], member);
|
||||
+ free (member);
|
||||
+ }
|
||||
+ TEST_COMPARE_STRING (e->sg_mem[1000], NULL);
|
||||
+
|
||||
+ /* Check that putsgent brings back the input string. */
|
||||
+ xopen_memstream (&mem);
|
||||
+ TEST_COMPARE (putsgent (e, mem.out), 0);
|
||||
+ xfclose_memstream (&mem);
|
||||
+ /* Compare without the trailing '\n' that putsgent added. */
|
||||
+ TEST_COMPARE (mem.buffer[mem.length - 1], '\n');
|
||||
+ mem.buffer[mem.length - 1] = '\0';
|
||||
+ TEST_COMPARE_STRING (mem.buffer, input);
|
||||
+
|
||||
+ free (mem.buffer);
|
||||
+ free (input);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
--
|
||||
2.41.0
|
||||
|
30
iconv-error-verbosity.patch
Normal file
30
iconv-error-verbosity.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From fc72b6d7d818ab2868920af956d1542d03342a4d Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Tue, 1 Aug 2023 17:01:37 +0200
|
||||
Subject: [PATCH] iconv: restore verbosity with unrecognized encoding names
|
||||
(bug 30694)
|
||||
|
||||
Commit 91927b7c76 ("Rewrite iconv option parsing [BZ #19519]") changed the
|
||||
iconv program to call __gconv_open directly instead of the iconv_open
|
||||
wrapper, but the former does not set errno. Update the caller to
|
||||
interpret the return codes like iconv_open does.
|
||||
---
|
||||
iconv/iconv_prog.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
|
||||
index bee898c63c..cf32cf9b44 100644
|
||||
--- a/iconv/iconv_prog.c
|
||||
+++ b/iconv/iconv_prog.c
|
||||
@@ -187,7 +187,7 @@ main (int argc, char *argv[])
|
||||
|
||||
if (res != __GCONV_OK)
|
||||
{
|
||||
- if (errno == EINVAL)
|
||||
+ if (res == __GCONV_NOCONV || res == __GCONV_NODB)
|
||||
{
|
||||
/* Try to be nice with the user and tell her which of the
|
||||
two encoding names is wrong. This is possible because
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,44 +0,0 @@
|
||||
From 5f828ff824e3b7cd133ef905b8ae25ab8a8f3d66 Mon Sep 17 00:00:00 2001
|
||||
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue, 30 May 2023 16:40:38 -0300
|
||||
Subject: [PATCH] io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64
|
||||
|
||||
Different than other 64 bit architectures, powerpc64 defines the
|
||||
LFS POSIX lock constants with values similar to 32 ABI, which
|
||||
are meant to be used with fcntl64 syscall. Since powerpc64 kABI
|
||||
does not have fcntl, the constants are adjusted with the
|
||||
FCNTL_ADJUST_CMD macro.
|
||||
|
||||
The 4d0fe291aed3a476a changed the logic of generic constants
|
||||
LFS value are equal to the default values; which is now wrong
|
||||
for powerpc64.
|
||||
|
||||
Fix the value by explicit define the previous glibc constants
|
||||
(powerpc64 does not need to use the 32 kABI value, but it simplifies
|
||||
the FCNTL_ADJUST_CMD which should be kept as compatibility).
|
||||
|
||||
Checked on powerpc64-linux-gnu and powerpc-linux-gnu.
|
||||
---
|
||||
sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
|
||||
index 0905cd833c..f7615a447e 100644
|
||||
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
|
||||
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
|
||||
@@ -33,6 +33,12 @@
|
||||
# define __O_LARGEFILE 0200000
|
||||
#endif
|
||||
|
||||
+#if __WORDSIZE == 64
|
||||
+# define F_GETLK 5
|
||||
+# define F_SETLK 6
|
||||
+# define F_SETLKW 7
|
||||
+#endif
|
||||
+
|
||||
struct flock
|
||||
{
|
||||
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,159 +0,0 @@
|
||||
From c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos O'Donell <carlos@redhat.com>
|
||||
Date: Thu, 19 Jan 2023 12:50:20 +0100
|
||||
Subject: [PATCH] Account for grouping in printf width (bug 30068)
|
||||
|
||||
This is a partial fix for mishandling of grouping when formatting
|
||||
integers. It properly computes the width in the presence of grouping
|
||||
characters when the width is larger than the number of significant
|
||||
digits. The precision related issue is documented in bug 23432.
|
||||
|
||||
Co-authored-by: Andreas Schwab <schwab@suse.de>
|
||||
---
|
||||
stdio-common/Makefile | 2 ++
|
||||
stdio-common/tst-grouping3.c | 54 +++++++++++++++++++++++++++++
|
||||
stdio-common/vfprintf-process-arg.c | 22 +++++++++---
|
||||
3 files changed, 73 insertions(+), 5 deletions(-)
|
||||
create mode 100644 stdio-common/tst-grouping3.c
|
||||
|
||||
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
|
||||
index 34fdd6d1f8..652d9e5f95 100644
|
||||
--- a/stdio-common/Makefile
|
||||
+++ b/stdio-common/Makefile
|
||||
@@ -196,6 +196,7 @@ tests := \
|
||||
tst-gets \
|
||||
tst-grouping \
|
||||
tst-grouping2 \
|
||||
+ tst-grouping3 \
|
||||
tst-long-dbl-fphex \
|
||||
tst-memstream-string \
|
||||
tst-obprintf \
|
||||
@@ -340,6 +341,7 @@ $(objpfx)tst-sscanf.out: $(gen-locales)
|
||||
$(objpfx)tst-swprintf.out: $(gen-locales)
|
||||
$(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
|
||||
$(objpfx)tst-vfprintf-width-i18n.out: $(gen-locales)
|
||||
+$(objpfx)tst-grouping3.out: $(gen-locales)
|
||||
endif
|
||||
|
||||
tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace \
|
||||
diff --git a/stdio-common/tst-grouping3.c b/stdio-common/tst-grouping3.c
|
||||
new file mode 100644
|
||||
index 0000000000..e9e39218e2
|
||||
--- /dev/null
|
||||
+++ b/stdio-common/tst-grouping3.c
|
||||
@@ -0,0 +1,54 @@
|
||||
+/* Test printf with grouping and padding (bug 30068)
|
||||
+ Copyright (C) 2023 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 <locale.h>
|
||||
+#include <stdio.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ char buf[80];
|
||||
+
|
||||
+ xsetlocale (LC_NUMERIC, "de_DE.UTF-8");
|
||||
+
|
||||
+ /* The format string has the following conversion specifier:
|
||||
+ ' - Use thousands grouping.
|
||||
+ + - The result of a signed conversion shall begin with a sign.
|
||||
+ - - Left justified.
|
||||
+ 13 - Minimum 13 bytes of width.
|
||||
+ 9 - Minimum 9 digits of precision.
|
||||
+
|
||||
+ In bug 30068 the grouping characters were not accounted for in
|
||||
+ the width, and were added after the fact resulting in a 15-byte
|
||||
+ output instead of a 13-byte output. The two additional bytes
|
||||
+ come from the locale-specific thousands separator. This increase
|
||||
+ in size could result in a buffer overflow if a reasonable caller
|
||||
+ calculated the size of the expected buffer using nl_langinfo to
|
||||
+ determine the sie of THOUSEP in bytes.
|
||||
+
|
||||
+ This bug is distinct from bug 23432 which has to do with the
|
||||
+ minimum precision calculation (digit based). */
|
||||
+ sprintf (buf, "%+-'13.9d", 1234567);
|
||||
+ TEST_COMPARE_STRING (buf, "+001.234.567 ");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/stdio-common/vfprintf-process-arg.c b/stdio-common/vfprintf-process-arg.c
|
||||
index 24c9125f9f..8c0fcbcf78 100644
|
||||
--- a/stdio-common/vfprintf-process-arg.c
|
||||
+++ b/stdio-common/vfprintf-process-arg.c
|
||||
@@ -186,11 +186,17 @@ LABEL (unsigned_number): /* Unsigned number of base BASE. */
|
||||
bool octal_marker = (prec <= number_length && number.word != 0
|
||||
&& alt && base == 8);
|
||||
|
||||
- prec = MAX (0, prec - (workend - string));
|
||||
+ /* At this point prec_inc is the additional bytes required for the
|
||||
+ specificed precision. It is 0 if the precision would not have
|
||||
+ required additional bytes i.e. the number of input digits is more
|
||||
+ than the precision. It is greater than zero if the precision is
|
||||
+ more than the number of digits without grouping (precision only
|
||||
+ considers digits). */
|
||||
+ unsigned int prec_inc = MAX (0, prec - (workend - string));
|
||||
|
||||
if (!left)
|
||||
{
|
||||
- width -= number_length + prec;
|
||||
+ width -= number_length + prec_inc;
|
||||
|
||||
if (number.word != 0 && alt && (base == 16 || base == 2))
|
||||
/* Account for 0X, 0x, 0B or 0b hex or binary marker. */
|
||||
@@ -221,7 +227,7 @@ LABEL (unsigned_number): /* Unsigned number of base BASE. */
|
||||
Xprintf_buffer_putc (buf, spec);
|
||||
}
|
||||
|
||||
- width += prec;
|
||||
+ width += prec_inc;
|
||||
Xprintf_buffer_pad (buf, L_('0'), width);
|
||||
|
||||
if (octal_marker)
|
||||
@@ -237,6 +243,8 @@ LABEL (unsigned_number): /* Unsigned number of base BASE. */
|
||||
}
|
||||
else
|
||||
{
|
||||
+ /* Perform left justification adjustments. */
|
||||
+
|
||||
if (is_negative)
|
||||
{
|
||||
Xprintf_buffer_putc (buf, L_('-'));
|
||||
@@ -263,9 +271,13 @@ LABEL (unsigned_number): /* Unsigned number of base BASE. */
|
||||
if (octal_marker)
|
||||
--width;
|
||||
|
||||
- width -= workend - string + prec;
|
||||
+ /* Adjust the width by subtracting the number of bytes
|
||||
+ required to represent the number with grouping characters
|
||||
+ (NUMBER_LENGTH) and any additional bytes required for
|
||||
+ precision. */
|
||||
+ width -= number_length + prec_inc;
|
||||
|
||||
- Xprintf_buffer_pad (buf, L_('0'), prec);
|
||||
+ Xprintf_buffer_pad (buf, L_('0'), prec_inc);
|
||||
|
||||
if (octal_marker)
|
||||
Xprintf_buffer_putc (buf, L_('0'));
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 0930ff8eb35cb493c945f176c3c9ab320f4d1b86 Mon Sep 17 00:00:00 2001
|
||||
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Thu, 6 Jul 2023 11:09:44 -0400
|
||||
Subject: [PATCH] realloc: Limit chunk reuse to only growing requests [BZ
|
||||
#30579]
|
||||
|
||||
The trim_threshold is too aggressive a heuristic to decide if chunk
|
||||
reuse is OK for reallocated memory; for repeated small, shrinking
|
||||
allocations it leads to internal fragmentation and for repeated larger
|
||||
allocations that fragmentation may blow up even worse due to the dynamic
|
||||
nature of the threshold.
|
||||
|
||||
Limit reuse only when it is within the alignment padding, which is 2 *
|
||||
size_t for heap allocations and a page size for mmapped allocations.
|
||||
There's the added wrinkle of THP, but this fix ignores it for now,
|
||||
pessimizing that case in favor of keeping fragmentation low.
|
||||
|
||||
This resolves BZ #30579.
|
||||
|
||||
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Reported-by: Nicolas Dusart <nicolas@freedelity.be>
|
||||
Reported-by: Aurelien Jarno <aurelien@aurel32.net>
|
||||
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
|
||||
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
|
||||
(cherry picked from commit 2fb12bbd092b0c10f1f2083216e723d2406e21c4)
|
||||
---
|
||||
malloc/malloc.c | 23 +++++++++++++++--------
|
||||
1 file changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
||||
index fd8b52bfac..67df9f8c51 100644
|
||||
--- a/malloc/malloc.c
|
||||
+++ b/malloc/malloc.c
|
||||
@@ -3398,16 +3398,23 @@ __libc_realloc (void *oldmem, size_t bytes)
|
||||
if (__glibc_unlikely (mtag_enabled))
|
||||
*(volatile char*) oldmem;
|
||||
|
||||
- /* Return the chunk as is whenever possible, i.e. there's enough usable space
|
||||
- but not so much that we end up fragmenting the block. We use the trim
|
||||
- threshold as the heuristic to decide the latter. */
|
||||
- size_t usable = musable (oldmem);
|
||||
- if (bytes <= usable
|
||||
- && (unsigned long) (usable - bytes) <= mp_.trim_threshold)
|
||||
- return oldmem;
|
||||
-
|
||||
/* chunk corresponding to oldmem */
|
||||
const mchunkptr oldp = mem2chunk (oldmem);
|
||||
+
|
||||
+ /* Return the chunk as is if the request grows within usable bytes, typically
|
||||
+ into the alignment padding. We want to avoid reusing the block for
|
||||
+ shrinkages because it ends up unnecessarily fragmenting the address space.
|
||||
+ This is also why the heuristic misses alignment padding for THP for
|
||||
+ now. */
|
||||
+ size_t usable = musable (oldmem);
|
||||
+ if (bytes <= usable)
|
||||
+ {
|
||||
+ size_t difference = usable - bytes;
|
||||
+ if ((unsigned long) difference < 2 * sizeof (INTERNAL_SIZE_T)
|
||||
+ || (chunk_is_mmapped (oldp) && difference <= GLRO (dl_pagesize)))
|
||||
+ return oldmem;
|
||||
+ }
|
||||
+
|
||||
/* its size */
|
||||
const INTERNAL_SIZE_T oldsize = chunksize (oldp);
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,137 +0,0 @@
|
||||
From 41349f6f67c83e7bafe49f985b56493d2c4c9c77 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Thu, 26 Jan 2023 14:25:05 +0100
|
||||
Subject: [PATCH] Use 64-bit time_t interfaces in strftime and strptime (bug
|
||||
30053)
|
||||
|
||||
Both functions use time_t only internally, so the ABI is not affected.
|
||||
---
|
||||
time/Makefile | 3 ++-
|
||||
time/strftime_l.c | 4 +++
|
||||
time/strptime_l.c | 4 ++-
|
||||
time/tst-strftime4-time64.c | 1 +
|
||||
time/tst-strftime4.c | 52 +++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 62 insertions(+), 2 deletions(-)
|
||||
create mode 100644 time/tst-strftime4-time64.c
|
||||
create mode 100644 time/tst-strftime4.c
|
||||
|
||||
diff --git a/time/Makefile b/time/Makefile
|
||||
index d86f2105c5..92bc3db315 100644
|
||||
--- a/time/Makefile
|
||||
+++ b/time/Makefile
|
||||
@@ -50,7 +50,7 @@ tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
|
||||
tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1 \
|
||||
tst-adjtime tst-ctime tst-difftime tst-mktime4 tst-clock_settime \
|
||||
tst-settimeofday tst-itimer tst-gmtime tst-timegm \
|
||||
- tst-timespec_get tst-timespec_getres
|
||||
+ tst-timespec_get tst-timespec_getres tst-strftime4
|
||||
|
||||
tests-time64 := \
|
||||
tst-adjtime-time64 \
|
||||
@@ -65,6 +65,7 @@ tests-time64 := \
|
||||
tst-itimer-time64 \
|
||||
tst-mktime4-time64 \
|
||||
tst-settimeofday-time64 \
|
||||
+ tst-strftime4-time64 \
|
||||
tst-timegm-time64 \
|
||||
tst-timespec_get-time64 \
|
||||
tst-timespec_getres-time64 \
|
||||
diff --git a/time/strftime_l.c b/time/strftime_l.c
|
||||
index e09561c39c..402c6c4111 100644
|
||||
--- a/time/strftime_l.c
|
||||
+++ b/time/strftime_l.c
|
||||
@@ -159,6 +159,10 @@ extern char *tzname[];
|
||||
#ifdef _LIBC
|
||||
# define tzname __tzname
|
||||
# define tzset __tzset
|
||||
+
|
||||
+# define time_t __time64_t
|
||||
+# define __gmtime_r(t, tp) __gmtime64_r (t, tp)
|
||||
+# define mktime(tp) __mktime64 (tp)
|
||||
#endif
|
||||
|
||||
#if !HAVE_TM_GMTOFF
|
||||
diff --git a/time/strptime_l.c b/time/strptime_l.c
|
||||
index 80fd705b8d..85c3249fcc 100644
|
||||
--- a/time/strptime_l.c
|
||||
+++ b/time/strptime_l.c
|
||||
@@ -30,8 +30,10 @@
|
||||
#ifdef _LIBC
|
||||
# define HAVE_LOCALTIME_R 0
|
||||
# include "../locale/localeinfo.h"
|
||||
-#endif
|
||||
|
||||
+# define time_t __time64_t
|
||||
+# define __localtime_r(t, tp) __localtime64_r (t, tp)
|
||||
+#endif
|
||||
|
||||
#if ! HAVE_LOCALTIME_R && ! defined localtime_r
|
||||
# ifdef _LIBC
|
||||
diff --git a/time/tst-strftime4-time64.c b/time/tst-strftime4-time64.c
|
||||
new file mode 100644
|
||||
index 0000000000..4d47ee7d79
|
||||
--- /dev/null
|
||||
+++ b/time/tst-strftime4-time64.c
|
||||
@@ -0,0 +1 @@
|
||||
+#include "tst-strftime4.c"
|
||||
diff --git a/time/tst-strftime4.c b/time/tst-strftime4.c
|
||||
new file mode 100644
|
||||
index 0000000000..659716d0fa
|
||||
--- /dev/null
|
||||
+++ b/time/tst-strftime4.c
|
||||
@@ -0,0 +1,52 @@
|
||||
+/* Test strftime and strptime after 2038-01-19 03:14:07 UTC (bug 30053).
|
||||
+ Copyright (C) 2023 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 <time.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <support/check.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ TEST_VERIFY_EXIT (setenv ("TZ", "UTC0", 1) == 0);
|
||||
+ tzset ();
|
||||
+ if (sizeof (time_t) > 4)
|
||||
+ {
|
||||
+ time_t wrap = (time_t) 2147483648LL;
|
||||
+ char buf[80];
|
||||
+ struct tm *tm = gmtime (&wrap);
|
||||
+ TEST_VERIFY_EXIT (tm != NULL);
|
||||
+ TEST_VERIFY_EXIT (strftime (buf, sizeof buf, "%s", tm) > 0);
|
||||
+ puts (buf);
|
||||
+ TEST_VERIFY (strcmp (buf, "2147483648") == 0);
|
||||
+
|
||||
+ struct tm tm2;
|
||||
+ char *p = strptime (buf, "%s", &tm2);
|
||||
+ TEST_VERIFY_EXIT (p != NULL && *p == '\0');
|
||||
+ time_t t = mktime (&tm2);
|
||||
+ printf ("%lld\n", (long long) t);
|
||||
+ TEST_VERIFY (t == wrap);
|
||||
+ }
|
||||
+ else
|
||||
+ FAIL_UNSUPPORTED ("32-bit time_t");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,290 +0,0 @@
|
||||
From 436a604b7dc741fc76b5a6704c6cd8bb178518e7 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Yi <ayi@janestreet.com>
|
||||
Date: Tue, 7 Mar 2023 07:30:02 -0500
|
||||
Subject: [PATCH] posix: Fix system blocks SIGCHLD erroneously [BZ #30163]
|
||||
|
||||
Fix bug that SIGCHLD is erroneously blocked forever in the following
|
||||
scenario:
|
||||
|
||||
1. Thread A calls system but hasn't returned yet
|
||||
2. Thread B calls another system but returns
|
||||
|
||||
SIGCHLD would be blocked forever in thread B after its system() returns,
|
||||
even after the system() in thread A returns.
|
||||
|
||||
Although POSIX does not require, glibc system implementation aims to be
|
||||
thread and cancellation safe. This bug was introduced in
|
||||
5fb7fc96350575c9adb1316833e48ca11553be49 when we moved reverting signal
|
||||
mask to happen when the last concurrently running system returns,
|
||||
despite that signal mask is per thread. This commit reverts this logic
|
||||
and adds a test.
|
||||
|
||||
Signed-off-by: Adam Yi <ayi@janestreet.com>
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
---
|
||||
stdlib/tst-system.c | 26 +++++++++++++++++++
|
||||
support/Makefile | 2 ++
|
||||
support/dtotimespec-time64.c | 27 +++++++++++++++++++
|
||||
support/dtotimespec.c | 50 ++++++++++++++++++++++++++++++++++++
|
||||
support/shell-container.c | 28 ++++++++++++++++++++
|
||||
support/timespec.h | 4 +++
|
||||
sysdeps/posix/system.c | 6 ++---
|
||||
7 files changed, 140 insertions(+), 3 deletions(-)
|
||||
create mode 100644 support/dtotimespec-time64.c
|
||||
create mode 100644 support/dtotimespec.c
|
||||
|
||||
diff --git a/stdlib/tst-system.c b/stdlib/tst-system.c
|
||||
index 634acfe264..47a0afe6bf 100644
|
||||
--- a/stdlib/tst-system.c
|
||||
+++ b/stdlib/tst-system.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <support/check.h>
|
||||
#include <support/temp_file.h>
|
||||
#include <support/support.h>
|
||||
+#include <support/xthread.h>
|
||||
#include <support/xunistd.h>
|
||||
|
||||
static char *tmpdir;
|
||||
@@ -71,6 +72,20 @@ call_system (void *closure)
|
||||
}
|
||||
}
|
||||
|
||||
+static void *
|
||||
+sleep_and_check_sigchld (void *closure)
|
||||
+{
|
||||
+ double *seconds = (double *) closure;
|
||||
+ char cmd[namemax];
|
||||
+ sprintf (cmd, "sleep %lf" , *seconds);
|
||||
+ TEST_COMPARE (system (cmd), 0);
|
||||
+
|
||||
+ sigset_t blocked = {0};
|
||||
+ TEST_COMPARE (sigprocmask (SIG_BLOCK, NULL, &blocked), 0);
|
||||
+ TEST_COMPARE (sigismember (&blocked, SIGCHLD), 0);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
@@ -154,6 +169,17 @@ do_test (void)
|
||||
xchmod (_PATH_BSHELL, st.st_mode);
|
||||
}
|
||||
|
||||
+ {
|
||||
+ pthread_t long_sleep_thread = xpthread_create (NULL,
|
||||
+ sleep_and_check_sigchld,
|
||||
+ &(double) { 0.2 });
|
||||
+ pthread_t short_sleep_thread = xpthread_create (NULL,
|
||||
+ sleep_and_check_sigchld,
|
||||
+ &(double) { 0.1 });
|
||||
+ xpthread_join (short_sleep_thread);
|
||||
+ xpthread_join (long_sleep_thread);
|
||||
+ }
|
||||
+
|
||||
TEST_COMPARE (system (""), 0);
|
||||
|
||||
return 0;
|
||||
diff --git a/support/Makefile b/support/Makefile
|
||||
index d52c472755..05b31159ea 100644
|
||||
--- a/support/Makefile
|
||||
+++ b/support/Makefile
|
||||
@@ -32,6 +32,8 @@ libsupport-routines = \
|
||||
check_hostent \
|
||||
check_netent \
|
||||
delayed_exit \
|
||||
+ dtotimespec \
|
||||
+ dtotimespec-time64 \
|
||||
ignore_stderr \
|
||||
next_to_fault \
|
||||
oom_error \
|
||||
diff --git a/support/dtotimespec-time64.c b/support/dtotimespec-time64.c
|
||||
new file mode 100644
|
||||
index 0000000000..b3d5e351e3
|
||||
--- /dev/null
|
||||
+++ b/support/dtotimespec-time64.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* Convert double to timespec. 64-bit time support.
|
||||
+ Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library and is also part of gnulib.
|
||||
+ Patches to this file should be submitted to both projects.
|
||||
+
|
||||
+ 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 <time.h>
|
||||
+
|
||||
+#if __TIMESIZE != 64
|
||||
+# define timespec __timespec64
|
||||
+# define time_t __time64_t
|
||||
+# define dtotimespec dtotimespec_time64
|
||||
+# include "dtotimespec.c"
|
||||
+#endif
|
||||
diff --git a/support/dtotimespec.c b/support/dtotimespec.c
|
||||
new file mode 100644
|
||||
index 0000000000..cde5b4d74c
|
||||
--- /dev/null
|
||||
+++ b/support/dtotimespec.c
|
||||
@@ -0,0 +1,50 @@
|
||||
+/* Convert double to timespec.
|
||||
+ Copyright (C) 2011-2023 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library and is also part of gnulib.
|
||||
+ Patches to this file should be submitted to both projects.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+/* Convert the double value SEC to a struct timespec. Round toward
|
||||
+ positive infinity. On overflow, return an extremal value. */
|
||||
+
|
||||
+#include <support/timespec.h>
|
||||
+#include <intprops.h>
|
||||
+
|
||||
+struct timespec
|
||||
+dtotimespec (double sec)
|
||||
+{
|
||||
+ if (sec <= TYPE_MINIMUM (time_t))
|
||||
+ return make_timespec (TYPE_MINIMUM (time_t), 0);
|
||||
+ else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
|
||||
+ return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_HZ - 1);
|
||||
+ else
|
||||
+ {
|
||||
+ time_t s = sec;
|
||||
+ double frac = TIMESPEC_HZ * (sec - s);
|
||||
+ long ns = frac;
|
||||
+ ns += ns < frac;
|
||||
+ s += ns / TIMESPEC_HZ;
|
||||
+ ns %= TIMESPEC_HZ;
|
||||
+
|
||||
+ if (ns < 0)
|
||||
+ {
|
||||
+ s--;
|
||||
+ ns += TIMESPEC_HZ;
|
||||
+ }
|
||||
+
|
||||
+ return make_timespec (s, ns);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/support/shell-container.c b/support/shell-container.c
|
||||
index ffa3378b5e..b1f9e793c1 100644
|
||||
--- a/support/shell-container.c
|
||||
+++ b/support/shell-container.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <error.h>
|
||||
|
||||
#include <support/support.h>
|
||||
+#include <support/timespec.h>
|
||||
|
||||
/* Design considerations
|
||||
|
||||
@@ -169,6 +170,32 @@ kill_func (char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Emulate the "/bin/sleep" command. No suffix support. Options are
|
||||
+ ignored. */
|
||||
+static int
|
||||
+sleep_func (char **argv)
|
||||
+{
|
||||
+ if (argv[0] == NULL)
|
||||
+ {
|
||||
+ fprintf (stderr, "sleep: missing operand\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ char *endptr = NULL;
|
||||
+ double sec = strtod (argv[0], &endptr);
|
||||
+ if (endptr == argv[0] || errno == ERANGE || sec < 0)
|
||||
+ {
|
||||
+ fprintf (stderr, "sleep: invalid time interval '%s'\n", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ struct timespec ts = dtotimespec (sec);
|
||||
+ if (nanosleep (&ts, NULL) < 0)
|
||||
+ {
|
||||
+ fprintf (stderr, "sleep: failed to nanosleep: %s\n", strerror (errno));
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* This is a list of all the built-in commands we understand. */
|
||||
static struct {
|
||||
const char *name;
|
||||
@@ -179,6 +206,7 @@ static struct {
|
||||
{ "cp", copy_func },
|
||||
{ "exit", exit_func },
|
||||
{ "kill", kill_func },
|
||||
+ { "sleep", sleep_func },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
diff --git a/support/timespec.h b/support/timespec.h
|
||||
index 77b1e4e8d6..9559836d4c 100644
|
||||
--- a/support/timespec.h
|
||||
+++ b/support/timespec.h
|
||||
@@ -57,6 +57,8 @@ int support_timespec_check_in_range (struct timespec expected,
|
||||
struct timespec observed,
|
||||
double lower_bound, double upper_bound);
|
||||
|
||||
+struct timespec dtotimespec (double sec) __attribute__((const));
|
||||
+
|
||||
#else
|
||||
struct timespec __REDIRECT (timespec_add, (struct timespec, struct timespec),
|
||||
timespec_add_time64);
|
||||
@@ -82,6 +84,8 @@ int __REDIRECT (support_timespec_check_in_range, (struct timespec expected,
|
||||
double lower_bound,
|
||||
double upper_bound),
|
||||
support_timespec_check_in_range_time64);
|
||||
+
|
||||
+struct timespec __REDIRECT (dtotimespec, (double sec), dtotimespec_time64);
|
||||
#endif
|
||||
|
||||
/* Check that the timespec on the left represents a time before the
|
||||
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c
|
||||
index 2335a99184..d77720a625 100644
|
||||
--- a/sysdeps/posix/system.c
|
||||
+++ b/sysdeps/posix/system.c
|
||||
@@ -179,16 +179,16 @@ do_system (const char *line)
|
||||
as if the shell had terminated using _exit(127). */
|
||||
status = W_EXITCODE (127, 0);
|
||||
|
||||
+ /* sigaction can not fail with SIGINT/SIGQUIT used with old
|
||||
+ disposition. Same applies for sigprocmask. */
|
||||
DO_LOCK ();
|
||||
if (SUB_REF () == 0)
|
||||
{
|
||||
- /* sigaction can not fail with SIGINT/SIGQUIT used with old
|
||||
- disposition. Same applies for sigprocmask. */
|
||||
__sigaction (SIGINT, &intr, NULL);
|
||||
__sigaction (SIGQUIT, &quit, NULL);
|
||||
- __sigprocmask (SIG_SETMASK, &omask, NULL);
|
||||
}
|
||||
DO_UNLOCK ();
|
||||
+ __sigprocmask (SIG_SETMASK, &omask, NULL);
|
||||
|
||||
if (ret != 0)
|
||||
__set_errno (ret);
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 17a5177cbb228f22ef3e00d4bb66af71724a6d07 Mon Sep 17 00:00:00 2001
|
||||
From 65bb10c34ff3734373a8b4be4e707f0494449f17 Mon Sep 17 00:00:00 2001
|
||||
From: Giuliano Belinassi <gbelinassi@suse.de>
|
||||
Date: Wed, 24 May 2023 18:03:15 -0300
|
||||
Subject: [PATCH] Add Userspace Livepatch prologue into ASM functions
|
||||
@ -15,22 +15,22 @@ Signed-off-by: Giuliano Belinassi <gbelinassi@suse.de>
|
||||
Makeconfig | 5 +++++
|
||||
config.h.in | 3 +++
|
||||
config.make.in | 1 +
|
||||
configure | 20 ++++++++++++++++++++
|
||||
configure | 21 +++++++++++++++++++++
|
||||
configure.ac | 13 +++++++++++++
|
||||
sysdeps/x86/sysdep.h | 22 ++++++++++++++++++----
|
||||
sysdeps/x86_64/multiarch/strcmp-avx2.S | 5 +----
|
||||
sysdeps/x86_64/multiarch/strcmp-evex.S | 5 +----
|
||||
sysdeps/x86_64/multiarch/strcmp-sse4_2.S | 5 +----
|
||||
sysdeps/x86_64/sysdep.h | 13 +++++++++++++
|
||||
10 files changed, 76 insertions(+), 16 deletions(-)
|
||||
10 files changed, 77 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/Makeconfig b/Makeconfig
|
||||
index 2fda4af5f7..52a79bc0c0 100644
|
||||
index 77d7fd14df..765d72bcf5 100644
|
||||
--- a/Makeconfig
|
||||
+++ b/Makeconfig
|
||||
@@ -961,6 +961,11 @@ endif # $(+cflags) == ""
|
||||
$(+stack-protector) -fno-common
|
||||
+gcc-nowarn := -w
|
||||
@@ -984,6 +984,11 @@ else
|
||||
+cflags += $(no-fortify-source)
|
||||
endif
|
||||
|
||||
+# Add flags for Userspace Livepatching support.
|
||||
+ifeq (yes,$(enable-userspace-livepatch))
|
||||
@ -41,10 +41,10 @@ index 2fda4af5f7..52a79bc0c0 100644
|
||||
# used to compile and will be installed. Each can also contain an
|
||||
# include/ subdirectory, whose header files will be used to compile
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index 43d32518ab..32fc79a357 100644
|
||||
index 0dedc124f7..08b1868002 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -199,6 +199,9 @@
|
||||
@@ -204,6 +204,9 @@
|
||||
/* Define to 1 if libpthread actually resides in libc. */
|
||||
#define PTHREAD_IN_LIBC 0
|
||||
|
||||
@ -55,10 +55,10 @@ index 43d32518ab..32fc79a357 100644
|
||||
#define TIMEOUTFACTOR 1
|
||||
|
||||
diff --git a/config.make.in b/config.make.in
|
||||
index d7c416cbea..c6f6909d68 100644
|
||||
index d487a4f4e9..e48351c59a 100644
|
||||
--- a/config.make.in
|
||||
+++ b/config.make.in
|
||||
@@ -86,6 +86,7 @@ nss-crypt = @libc_cv_nss_crypt@
|
||||
@@ -85,6 +85,7 @@ nss-crypt = @libc_cv_nss_crypt@
|
||||
static-nss-crypt = @libc_cv_static_nss_crypt@
|
||||
|
||||
# Configuration options.
|
||||
@ -67,10 +67,10 @@ index d7c416cbea..c6f6909d68 100644
|
||||
build-profile = @profile@
|
||||
build-static-nss = @static_nss@
|
||||
diff --git a/configure b/configure
|
||||
index efb891456a..4030ccf701 100755
|
||||
index c02c0b5825..e2000fdc4a 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -591,6 +591,7 @@ LIBOBJS
|
||||
@@ -622,6 +622,7 @@ LIBOBJS
|
||||
pthread_in_libc
|
||||
RELEASE
|
||||
VERSION
|
||||
@ -78,31 +78,32 @@ index efb891456a..4030ccf701 100755
|
||||
mach_interface_list
|
||||
DEFINES
|
||||
static_nss
|
||||
@@ -789,6 +790,7 @@ enable_mathvec
|
||||
enable_cet
|
||||
@@ -819,6 +820,7 @@ enable_cet
|
||||
enable_scv
|
||||
enable_fortify_source
|
||||
with_cpu
|
||||
+enable_userspace_livepatch
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
@@ -1462,6 +1464,8 @@ Optional Features:
|
||||
(CET), x86 only
|
||||
--disable-scv syscalls will not use scv instruction, even if the
|
||||
kernel supports it, powerpc only
|
||||
@@ -1501,6 +1503,8 @@ Optional Features:
|
||||
Use -D_FORTIFY_SOURCE=[1|2|3] to control code
|
||||
hardening, defaults to highest possible value
|
||||
supported by the build compiler.
|
||||
+ --enable-userspace-livepatch
|
||||
+ build with userspace livepatch support [default=no]
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@@ -6751,6 +6755,22 @@ libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
|
||||
@@ -8004,6 +8008,23 @@ libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
|
||||
|
||||
|
||||
|
||||
+# Check whether --enable-userspace-livepatch was given.
|
||||
+if test "${enable_userspace_livepatch+set}" = set; then :
|
||||
+if test ${enable_userspace_livepatch+y}
|
||||
+then :
|
||||
+ enableval=$enable_userspace_livepatch; enable_userspace_livepatch=$enableval
|
||||
+else
|
||||
+else $as_nop
|
||||
+ enable_userspace_livepatch=no
|
||||
+fi
|
||||
+
|
||||
@ -110,7 +111,7 @@ index efb891456a..4030ccf701 100755
|
||||
+# Libpulp uses -fpatchable-function-entry to add padding NOPS to the
|
||||
+# prologue of all functions.
|
||||
+if test "x$enable_userspace_livepatch" = xyes; then
|
||||
+ $as_echo "#define ENABLE_USERSPACE_LIVEPATCH 1" >>confdefs.h
|
||||
+ printf "%s\n" "#define ENABLE_USERSPACE_LIVEPATCH 1" >>confdefs.h
|
||||
+
|
||||
+fi
|
||||
+
|
||||
@ -119,7 +120,7 @@ index efb891456a..4030ccf701 100755
|
||||
RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 011844a3d4..26c1a78009 100644
|
||||
index 09553541fb..a07e3d6284 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1827,6 +1827,19 @@ AC_SUBST(DEFINES)
|
||||
@ -181,7 +182,7 @@ index 0b3483a77a..329c16306e 100644
|
||||
/* Common entry 16 byte aligns. */
|
||||
#define ENTRY(name) ENTRY_P2ALIGN (name, 4)
|
||||
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
||||
index 07f8ec54c6..b22d59b5cf 100644
|
||||
index 8804338d75..d3584b2c5d 100644
|
||||
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
||||
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
||||
@@ -201,10 +201,7 @@ END (STRCASECMP)
|
||||
@ -197,7 +198,7 @@ index 07f8ec54c6..b22d59b5cf 100644
|
||||
# if defined USE_AS_STRCASECMP_L
|
||||
/* We have to fall back on the C implementation for locales with
|
||||
diff --git a/sysdeps/x86_64/multiarch/strcmp-evex.S b/sysdeps/x86_64/multiarch/strcmp-evex.S
|
||||
index a8bd5cd786..809ba10447 100644
|
||||
index ae39cdf217..44a8d4cee7 100644
|
||||
--- a/sysdeps/x86_64/multiarch/strcmp-evex.S
|
||||
+++ b/sysdeps/x86_64/multiarch/strcmp-evex.S
|
||||
@@ -224,10 +224,7 @@ END (STRCASECMP)
|
||||
@ -213,7 +214,7 @@ index a8bd5cd786..809ba10447 100644
|
||||
# if defined USE_AS_STRCASECMP_L
|
||||
/* We have to fall back on the C implementation for locales with
|
||||
diff --git a/sysdeps/x86_64/multiarch/strcmp-sse4_2.S b/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
|
||||
index f93c34465e..f96f66d54c 100644
|
||||
index cbb22884eb..327377daa6 100644
|
||||
--- a/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
|
||||
+++ b/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
|
||||
@@ -103,10 +103,7 @@ END (STRCASECMP)
|
||||
@ -253,5 +254,5 @@ index 6ca169573d..c18f0ef914 100644
|
||||
|
||||
/* This macro is for setting proper CFI with DW_CFA_expression describing
|
||||
--
|
||||
2.40.1
|
||||
2.41.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user