Update to 2.75.2

Refresh gnutls hmac patch.
This commit is contained in:
David King 2023-02-07 10:48:28 +00:00
parent cd991317b8
commit a6a8564759
4 changed files with 42 additions and 197 deletions

View File

@ -1,150 +0,0 @@
From 2a36bb4b7e46f9ac043561c61f9a790786a5440c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 28 Oct 2022 11:21:04 -0400
Subject: [PATCH 1/2] Revert "Handling collision between standard i/o file
descriptors and newly created ones"
g_unix_open_pipe tries to avoid the standard io fd range
when getting pipe fds. This turns out to be a bad idea because
certain buggy programs rely on it using that range.
This reverts commit d9ba6150909818beb05573f54f26232063492c5b
Closes: #2795
Reopens: #16
---
glib/glib-unix.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/glib/glib-unix.c b/glib/glib-unix.c
index 4710c51168..bc152d7663 100644
--- a/glib/glib-unix.c
+++ b/glib/glib-unix.c
@@ -108,17 +108,6 @@ g_unix_open_pipe (int *fds,
ecode = pipe2 (fds, pipe2_flags);
if (ecode == -1 && errno != ENOSYS)
return g_unix_set_error_from_errno (error, errno);
- /* Don't reassign pipes to stdin, stdout, stderr if closed meanwhile */
- else if (fds[0] < 3 || fds[1] < 3)
- {
- int old_fds[2] = { fds[0], fds[1] };
- gboolean result = g_unix_open_pipe (fds, flags, error);
- close (old_fds[0]);
- close (old_fds[1]);
-
- if (!result)
- g_unix_set_error_from_errno (error, errno);
- }
else if (ecode == 0)
return TRUE;
/* Fall through on -ENOSYS, we must be running on an old kernel */
@@ -127,19 +116,6 @@ g_unix_open_pipe (int *fds,
ecode = pipe (fds);
if (ecode == -1)
return g_unix_set_error_from_errno (error, errno);
- /* Don't reassign pipes to stdin, stdout, stderr if closed meanwhile */
- else if (fds[0] < 3 || fds[1] < 3)
- {
- int old_fds[2] = { fds[0], fds[1] };
- gboolean result = g_unix_open_pipe (fds, flags, error);
- close (old_fds[0]);
- close (old_fds[1]);
-
- if (!result)
- g_unix_set_error_from_errno (error, errno);
-
- return result;
- }
if (flags == 0)
return TRUE;
--
GitLab
From 1c1c452ff2030135e4abc2816e81b7078a845580 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 31 Oct 2022 09:17:55 -0400
Subject: [PATCH 2/2] glib-unix: Add test to make sure g_unix_open_pipe will
intrude standard range
Now that we know it's a bad idea to avoid the standard io fd range
when getting pipe fds for g_unix_open_pipe, we should test to make sure
we don't inadvertently try to do it again.
This commit adds that test.
---
glib/tests/unix.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/glib/tests/unix.c b/glib/tests/unix.c
index 2112cab6bf..6c4a59dee7 100644
--- a/glib/tests/unix.c
+++ b/glib/tests/unix.c
@@ -24,8 +24,11 @@
#include "config.h"
#include "glib-unix.h"
+#include "gstdio.h"
+
#include <string.h>
#include <pwd.h>
+#include <unistd.h>
static void
test_pipe (void)
@@ -52,6 +55,43 @@ test_pipe (void)
g_assert (g_str_has_prefix (buf, "hello"));
}
+static void
+test_pipe_stdio_overwrite (void)
+{
+ GError *error = NULL;
+ int pipefd[2], ret;
+ gboolean res;
+ int stdin_fd;
+
+
+ g_test_summary ("Test that g_unix_open_pipe() will use the first available FD, even if its stdin/stdout/stderr");
+ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/2795");
+
+ stdin_fd = dup (STDIN_FILENO);
+ g_assert_cmpint (stdin_fd, >, 0);
+
+ g_close (STDIN_FILENO, &error);
+ g_assert_no_error (error);
+
+ res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error);
+ g_assert_no_error (error);
+ g_assert_true (res);
+
+ g_assert_cmpint (pipefd[0], ==, STDIN_FILENO);
+
+ g_close (pipefd[0], &error);
+ g_assert_no_error (error);
+
+ g_close (pipefd[1], &error);
+ g_assert_no_error (error);
+
+ ret = dup2 (stdin_fd, STDIN_FILENO);
+ g_assert_cmpint (ret, >=, 0);
+
+ g_close (stdin_fd, &error);
+ g_assert_no_error (error);
+}
+
static void
test_error (void)
{
@@ -337,6 +377,7 @@ main (int argc,
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/glib-unix/pipe", test_pipe);
+ g_test_add_func ("/glib-unix/pipe-stdio-overwrite", test_pipe_stdio_overwrite);
g_test_add_func ("/glib-unix/error", test_error);
g_test_add_func ("/glib-unix/nonblocking", test_nonblocking);
g_test_add_func ("/glib-unix/sighup", test_sighup);
--
GitLab

View File

@ -1,5 +1,5 @@
Name: glib2
Version: 2.74.1
Version: 2.75.2
Release: %autorelease
Summary: A library of handy utility functions
@ -12,9 +12,6 @@ Source0: https://download.gnome.org/sources/glib/2.72/glib-%{version}.tar.xz
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/903
Patch0: gnutls-hmac.patch
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3039
Patch1: glib-2.74.1-revert-fd-handling.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gettext

View File

@ -1,4 +1,4 @@
From 4fb2d2ba67cbf97a728ef5fe8b29e1f3df0a7f85 Mon Sep 17 00:00:00 2001
From a2d4c9a46a9955b9fdf63d1ed9355a46d1bab4f4 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Fri, 7 Jun 2019 18:44:43 +0000
Subject: [PATCH 1/4] ghmac: Split off wrapper functions into ghmac-utils.c
@ -284,10 +284,10 @@ index 7ad28d6f0..516b01b24 100644
- (const guchar *) str, length);
-}
diff --git a/glib/meson.build b/glib/meson.build
index 6062c11a1..6624dab48 100644
index b623983e3..46e3391e4 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -248,6 +248,7 @@ glib_sources = files(
@@ -279,6 +279,7 @@ glib_sources += files(
'ggettext.c',
'ghash.c',
'ghmac.c',
@ -296,10 +296,10 @@ index 6062c11a1..6624dab48 100644
'ghostutils.c',
'giochannel.c',
--
2.36.1
2.39.1
From 9df3337f963e2317ae23e7fc8dabf536c218c629 Mon Sep 17 00:00:00 2001
From 2932ee3dffd6f48f1855881b39e3c6bfed67a3f7 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Fri, 7 Jun 2019 19:36:54 +0000
Subject: [PATCH 2/4] Add a gnutls backend for GHmac
@ -353,10 +353,10 @@ https://gitlab.gnome.org/GNOME/glib/-/merge_requests/903
glib/gchecksumprivate.h | 32 +++++++
glib/ghmac-gnutls.c | 187 ++++++++++++++++++++++++++++++++++++++++
glib/ghmac.c | 15 ++++
glib/meson.build | 10 ++-
glib/meson.build | 9 +-
meson.build | 7 ++
meson_options.txt | 5 ++
7 files changed, 259 insertions(+), 6 deletions(-)
7 files changed, 259 insertions(+), 5 deletions(-)
create mode 100644 glib/gchecksumprivate.h
create mode 100644 glib/ghmac-gnutls.c
@ -660,10 +660,10 @@ index 516b01b24..a4851cc64 100644
* Use g_hmac_unref() to free the memory allocated by it.
*
diff --git a/glib/meson.build b/glib/meson.build
index 6624dab48..4e3365f61 100644
index 46e3391e4..9c15e64c1 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -247,7 +247,6 @@ glib_sources = files(
@@ -278,7 +278,6 @@ glib_sources += files(
'gfileutils.c',
'ggettext.c',
'ghash.c',
@ -671,7 +671,7 @@ index 6624dab48..4e3365f61 100644
'ghmac-utils.c',
'ghook.c',
'ghostutils.c',
@@ -303,6 +302,7 @@ glib_sources = files(
@@ -334,6 +333,7 @@ glib_sources += files(
'guriprivate.h',
'gutils.c',
'gutilsprivate.h',
@ -679,7 +679,7 @@ index 6624dab48..4e3365f61 100644
'guuid.c',
'gvariant.c',
'gvariant-core.c',
@@ -358,6 +358,12 @@ else
@@ -393,6 +393,12 @@ else
glib_dtrace_hdr = []
endif
@ -692,20 +692,19 @@ index 6624dab48..4e3365f61 100644
pcre2_static_args = []
if use_pcre2_static_flag
@@ -376,7 +382,7 @@ libglib = library('glib-2.0',
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
include_directories : configinc,
@@ -413,6 +419,7 @@ libglib = library('glib-2.0',
link_with: [charset_lib, gnulib_lib],
- dependencies : [pcre2, thread_dep, librt] + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
+ dependencies : [pcre2, thread_dep, librt] + libgnutls_dep + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
c_args : glib_c_args,
objc_args : glib_c_args,
)
dependencies : [
gnulib_libm_dependency,
+ libgnutls_dep,
libiconv,
libintl_deps,
libm,
diff --git a/meson.build b/meson.build
index b3dea2ea1..464e59e09 100644
index 334b208b6..40bcd5544 100644
--- a/meson.build
+++ b/meson.build
@@ -2113,6 +2113,13 @@ if host_system == 'linux'
@@ -2139,6 +2139,13 @@ if host_system == 'linux'
glib_conf.set('HAVE_LIBMOUNT', libmount_dep.found())
endif
@ -720,10 +719,10 @@ index b3dea2ea1..464e59e09 100644
winsock2 = cc.find_library('ws2_32')
else
diff --git a/meson_options.txt b/meson_options.txt
index a52eed9d2..4eb577798 100644
index 517d5757c..2380a60ba 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -34,6 +34,11 @@ option('libmount',
@@ -37,6 +37,11 @@ option('libmount',
value : 'auto',
description : 'build with libmount support')
@ -736,10 +735,10 @@ index a52eed9d2..4eb577798 100644
type : 'boolean',
value : false,
--
2.36.1
2.39.1
From 019c4323d379c80344a0146e1fee2008fd6d3b51 Mon Sep 17 00:00:00 2001
From d6620c9371f219959e6bc235e0d344ce9812a194 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Wed, 16 Jun 2021 20:35:00 -0500
Subject: [PATCH 3/4] dlopen GnuTLS instead of linking directly
@ -762,9 +761,9 @@ for our purposes.
---
glib/ghmac-gnutls.c | 101 ++++++++++++++++++++++++++++++++++++++++++--
glib/ghmac.c | 2 +-
glib/meson.build | 2 +-
glib/meson.build | 1 -
meson.build | 6 +--
4 files changed, 102 insertions(+), 9 deletions(-)
4 files changed, 101 insertions(+), 9 deletions(-)
diff --git a/glib/ghmac-gnutls.c b/glib/ghmac-gnutls.c
index 9fb775f89..1800fc2e0 100644
@ -921,23 +920,22 @@ index a4851cc64..20e64fd00 100644
#endif
diff --git a/glib/meson.build b/glib/meson.build
index 4e3365f61..3b2a246c4 100644
index 9c15e64c1..c41f110ae 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -382,7 +382,7 @@ libglib = library('glib-2.0',
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
include_directories : configinc,
@@ -419,7 +419,6 @@ libglib = library('glib-2.0',
link_with: [charset_lib, gnulib_lib],
- dependencies : [pcre2, thread_dep, librt] + libgnutls_dep + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
+ dependencies : [pcre2, thread_dep, librt] + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep] + [libdl_dep],
c_args : glib_c_args,
objc_args : glib_c_args,
)
dependencies : [
gnulib_libm_dependency,
- libgnutls_dep,
libiconv,
libintl_deps,
libm,
diff --git a/meson.build b/meson.build
index 464e59e09..366c35fef 100644
index 40bcd5544..1c1f5750b 100644
--- a/meson.build
+++ b/meson.build
@@ -2113,11 +2113,9 @@ if host_system == 'linux'
@@ -2139,11 +2139,9 @@ if host_system == 'linux'
glib_conf.set('HAVE_LIBMOUNT', libmount_dep.found())
endif
@ -952,10 +950,10 @@ index 464e59e09..366c35fef 100644
if host_system == 'windows'
--
2.36.1
2.39.1
From 67f0f37e072b8629644efd4a657f73ce72da042b Mon Sep 17 00:00:00 2001
From 69f5c7b41e55c14beaeff32cea289be841d4ee1d Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Wed, 16 Jun 2021 20:46:24 -0500
Subject: [PATCH 4/4] Add test for GHmac in FIPS mode
@ -975,7 +973,7 @@ tests.
1 file changed, 46 insertions(+)
diff --git a/glib/tests/hmac.c b/glib/tests/hmac.c
index 3ac3206df..2fa447984 100644
index 3ac3206df..79c91d19c 100644
--- a/glib/tests/hmac.c
+++ b/glib/tests/hmac.c
@@ -1,7 +1,10 @@
@ -1086,5 +1084,5 @@ index 3ac3206df..2fa447984 100644
return g_test_run ();
}
--
2.36.1
2.39.1

View File

@ -1 +1 @@
SHA512 (glib-2.74.1.tar.xz) = 21176cb95fcab49a781d02789bf21191a96a34a6391f066699b3c20b414b3169c958bd86623deb34ca55912083862885f7a7d12b67cc041467da2ba94d9e83c3
SHA512 (glib-2.75.2.tar.xz) = f8e34d112c720e17fbc2325e5091f55d120cc82aa2a9012c6e9e3b81a969af97e501910f3f986fa305ab1abfbd77e69ee9c71bcdda33c6795c3b087e684272f6