Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update glibc to 2.34 #1763

Merged
merged 5 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions macros/shared
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pkgconfig = '/usr/bin/pkg-config'\
c_args = [%{_cross_c_args}]\
c_link_args = [%{_cross_c_link_args}]\
pkg_config_libdir = '%{_cross_pkgconfigdir}'\
needs_exe_wrapper = true\
[host_machine]\
system = 'linux'\
cpu_family ='%{_cross_cpu_family}'\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From bbbd80bf03223f181d4abf5c8e5fe6136ab6129a Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 9 Aug 2021 11:48:21 +0200
Subject: [PATCH] sys_linux: allow clone3 and pread64 in seccomp filter

These seem to be needed with the latest glibc.
---
sys_linux.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/sys_linux.c b/sys_linux.c
index 50c0843..2b53f72 100644
--- a/sys_linux.c
+++ b/sys_linux.c
@@ -503,6 +503,9 @@ SYS_Linux_EnableSystemCallFilter(int level, SYS_ProcessContext context)

/* Process */
SCMP_SYS(clone),
+#ifdef __NR_clone3
+ SCMP_SYS(clone3),
+#endif
SCMP_SYS(exit),
SCMP_SYS(exit_group),
SCMP_SYS(getpid),
@@ -595,6 +598,7 @@ SYS_Linux_EnableSystemCallFilter(int level, SYS_ProcessContext context)
#ifdef __NR_ppoll_time64
SCMP_SYS(ppoll_time64),
#endif
+ SCMP_SYS(pread64),
SCMP_SYS(pselect6),
#ifdef __NR_pselect6_time64
SCMP_SYS(pselect6_time64),
--
2.21.3

4 changes: 4 additions & 0 deletions packages/chrony/chrony.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Source1: chronyd.service
Source2: chrony-conf
Source3: chrony-sysusers.conf
Source4: chrony-tmpfiles.conf

# Fix seccomp filter for glibc 2.34+
Patch0001: 0001-sys_linux-allow-clone3-and-pread64-in-seccomp-filter.patch

BuildRequires: %{_cross_os}glibc-devel
BuildRequires: %{_cross_os}libcap-devel
BuildRequires: %{_cross_os}libseccomp-devel
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 0b03996304f86d6dba8f0d4b7048b9bb7186f17d Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:10 +0530
Subject: [PATCH 01/26] ldconfig: avoid leak on empty paths in config file

Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit b0234d79e7d82475d1666f25326ec045c045b3ed)
---
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.21.3

38 changes: 38 additions & 0 deletions packages/glibc/0002-gconv_parseconfdir-Fix-memory-leak.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 3a48da47a91ccc6f5de260574809e7a44551b876 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:20 +0530
Subject: [PATCH 02/26] 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>
(cherry picked from commit 5f9b78fe35d08739b6da1e5b356786d41116c108)
---
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.21.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From a5bd2e10e0c25b80286dc36068e22a4cb4893af0 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:11:03 +0530
Subject: [PATCH 03/26] 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>
(cherry picked from commit 77a34079d8f3d63b61543bf3af93043f8674e4c4)
---
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.21.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 7ff4da3dc26de351a5abe7c2905038cbe55c8041 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:53 +0530
Subject: [PATCH 04/26] 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>
(cherry picked from commit 45caed9d67a00af917d8b5b88d4b5eb1225b7aef)
---
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.21.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 9995d0588f4f9adc68419224d2b3698e2ca4f77e Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Tue, 3 Aug 2021 21:10:29 +0530
Subject: [PATCH 05/26] iconv_charmap: Close output file when done

Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff)
---
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.21.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
From 31902ae639d6a50e768a85f1cd2a17e56b8463c2 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 6 Aug 2021 09:51:38 +0200
Subject: [PATCH 06/26] 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>
(cherry picked from commit c87fcacc50505d550f1bb038382bcc7ea73a5926)
---
NEWS | 7 +++++++
io/fcntl.h | 8 ++++----
misc/sys/ioctl.h | 4 ++--
sysdeps/unix/sysv/linux/sys/prctl.h | 2 +-
4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index 3c610744c9..89e20cf062 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,13 @@ See the end for copying conditions.
Please send GNU C library bug reports via <https://sourceware.org/bugzilla/>
using `glibc' in the "product" field.

+Version 2.34.1
+
+The following bugs are resolved with this release:
+
+ [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
+
+
Version 2.34

Major new features:
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.21.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 79474303223c5665bec75ffbdb2a86ee04a2514b Mon Sep 17 00:00:00 2001
From: Nikita Popov <npv1310@gmail.com>
Date: Mon, 9 Aug 2021 20:17:34 +0530
Subject: [PATCH 07/26] 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>
(cherry picked from commit b805aebd42364fe696e417808a700fdb9800c9e8)
---
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.21.3

Loading