summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2024-11-12 20:59:21 +0100
committerSteve Sakoman <steve@sakoman.com>2024-11-15 06:05:32 -0800
commitf13a22028849324f1003fce2b92fbb30f131d601 (patch)
treeb9c60e23bb27ff5d3320b93367f82b360739a6e5
parent05e809ccb080c7fd2c3f9cfc23328a968200905f (diff)
downloadpoky-f13a22028849324f1003fce2b92fbb30f131d601.tar.gz
glib-2.0: patch regression of CVE-2023-32665
Official CVE-2023-32665 patch introduced a regression for big-endian architectures. This code was backported in CVE-2023-32665-0003.patch Reported in [1] and fixed by [2] where this patch is picked from. [1] https://gitlab.gnome.org/GNOME/glib/-/issues/2839 [2] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3136 (From OE-Core rev: 2400e143477cc93d4698df921bd89ef4b8b4692b) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-gvariant-serialiser-Convert-endianness-of-offsets.patch68
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb1
2 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-gvariant-serialiser-Convert-endianness-of-offsets.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-gvariant-serialiser-Convert-endianness-of-offsets.patch
new file mode 100644
index 0000000000..86cce768ed
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-gvariant-serialiser-Convert-endianness-of-offsets.patch
@@ -0,0 +1,68 @@
1From dc16dffed0480d0c8cdd6a05ede68263fc8723a9 Mon Sep 17 00:00:00 2001
2From: Simon McVittie <smcv@collabora.com>
3Date: Thu, 15 Dec 2022 12:51:37 +0000
4Subject: [PATCH] gvariant-serialiser: Convert endianness of offsets
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The array of offsets is little-endian, even on big-endian architectures
10like s390x.
11
12Fixes: ade71fb5 "gvariant: Don’t allow child elements to overlap with each other"
13Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2839
14Signed-off-by: Simon McVittie <smcv@collabora.com>
15
16Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/dc16dffed0480d0c8cdd6a05ede68263fc8723a9]
17Signed-off-by: Peter Marko <peter.marko@siemens.com>
18---
19 glib/gvariant-serialiser.c | 19 +++++++++++--------
20 1 file changed, 11 insertions(+), 8 deletions(-)
21
22diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
23index 25c85b30b..e9b0eab2b 100644
24--- a/glib/gvariant-serialiser.c
25+++ b/glib/gvariant-serialiser.c
26@@ -712,17 +712,19 @@ gvs_variable_sized_array_n_children (GVariantSerialised value)
27 /* Find the index of the first out-of-order element in @data, assuming that
28 * @data is an array of elements of given @type, starting at index @start and
29 * containing a further @len-@start elements. */
30-#define DEFINE_FIND_UNORDERED(type) \
31+#define DEFINE_FIND_UNORDERED(type, le_to_native) \
32 static gsize \
33 find_unordered_##type (const guint8 *data, gsize start, gsize len) \
34 { \
35 gsize off; \
36- type current, previous; \
37+ type current_le, previous_le, current, previous; \
38 \
39- memcpy (&previous, data + start * sizeof (current), sizeof (current)); \
40+ memcpy (&previous_le, data + start * sizeof (current), sizeof (current)); \
41+ previous = le_to_native (previous_le); \
42 for (off = (start + 1) * sizeof (current); off < len * sizeof (current); off += sizeof (current)) \
43 { \
44- memcpy (&current, data + off, sizeof (current)); \
45+ memcpy (&current_le, data + off, sizeof (current)); \
46+ current = le_to_native (current_le); \
47 if (current < previous) \
48 break; \
49 previous = current; \
50@@ -730,10 +732,11 @@ gvs_variable_sized_array_n_children (GVariantSerialised value)
51 return off / sizeof (current) - 1; \
52 }
53
54-DEFINE_FIND_UNORDERED (guint8);
55-DEFINE_FIND_UNORDERED (guint16);
56-DEFINE_FIND_UNORDERED (guint32);
57-DEFINE_FIND_UNORDERED (guint64);
58+#define NO_CONVERSION(x) (x)
59+DEFINE_FIND_UNORDERED (guint8, NO_CONVERSION);
60+DEFINE_FIND_UNORDERED (guint16, GUINT16_FROM_LE);
61+DEFINE_FIND_UNORDERED (guint32, GUINT32_FROM_LE);
62+DEFINE_FIND_UNORDERED (guint64, GUINT64_FROM_LE);
63
64 static GVariantSerialised
65 gvs_variable_sized_array_get_child (GVariantSerialised value,
66--
672.30.2
68
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb
index 35b51a3ec9..239099d568 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb
@@ -49,6 +49,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
49 file://CVE-2024-34397_16.patch \ 49 file://CVE-2024-34397_16.patch \
50 file://CVE-2024-34397_17.patch \ 50 file://CVE-2024-34397_17.patch \
51 file://CVE-2024-34397_18.patch \ 51 file://CVE-2024-34397_18.patch \
52 file://0001-gvariant-serialiser-Convert-endianness-of-offsets.patch \
52 " 53 "
53SRC_URI:append:class-native = " file://relocate-modules.patch" 54SRC_URI:append:class-native = " file://relocate-modules.patch"
54 55