summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2023-05-23 03:14:06 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-25 10:29:09 +0100
commit67ad6c8dc2d5d7512cb36d6eccbd73130b9a9197 (patch)
treee530c0f7950ba3f543c057a1db133680730a8ba8 /meta/recipes-core/glib-2.0
parent63a7ae21cc6d0c9c7f880220e9e3d9acea6f204e (diff)
downloadpoky-67ad6c8dc2d5d7512cb36d6eccbd73130b9a9197.tar.gz
glib-2.0: Avoid having g_futex_simple() inadvertently modify errno
If both __NR_futex and __NR_futex_time64 are defined, g_futex_simple() will first call futex_time64(). If that fails with ENOSYS, then futex_time() is called instead. However, errno was not saved and restored in this case, which would result in g_futex_simple() returning with errno set to ENOSYS, even if futex_time() succeeded. (From OE-Core rev: 1d6bff65391045ba40e84721eb0f6826e25e09f3) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glib-2.0')
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch36
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb1
2 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch
new file mode 100644
index 0000000000..db63cfd91e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch
@@ -0,0 +1,36 @@
1From edd1e47f107410d9e4edb691335410026ae5a534 Mon Sep 17 00:00:00 2001
2From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
3Date: Tue, 25 Apr 2023 20:02:31 +0200
4Subject: [PATCH] Avoid having g_futex_simple() inadvertently modify errno
5
6If both __NR_futex and __NR_futex_time64 are defined, g_futex_simple()
7will first call futex_time64(). If that fails with ENOSYS, then
8futex_time() is called instead. However, errno was not saved and
9restored in this case, which would result in g_futex_simple()
10returning with errno set to ENOSYS, even if futex_time() succeeded.
11
12Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/edd1e47f107410d9e4edb691335410026ae5a534]
13Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
14---
15 glib/gthreadprivate.h | 6 +++++-
16 1 file changed, 5 insertions(+), 1 deletion(-)
17
18diff --git a/glib/gthreadprivate.h b/glib/gthreadprivate.h
19index 9c847e039..74d37ba32 100644
20--- a/glib/gthreadprivate.h
21+++ b/glib/gthreadprivate.h
22@@ -65,9 +65,13 @@ struct _GRealThread
23 #define g_futex_simple(uaddr, futex_op, ...) \
24 G_STMT_START \
25 { \
26+ int saved_errno = errno; \
27 int res = syscall (__NR_futex_time64, uaddr, (gsize) futex_op, __VA_ARGS__); \
28 if (res < 0 && errno == ENOSYS) \
29- syscall (__NR_futex, uaddr, (gsize) futex_op, __VA_ARGS__); \
30+ { \
31+ errno = saved_errno; \
32+ syscall (__NR_futex, uaddr, (gsize) futex_op, __VA_ARGS__); \
33+ } \
34 } \
35 G_STMT_END
36 #elif defined(__NR_futex_time64)
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb
index 224f2c262e..f3a716eb9d 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb
@@ -14,6 +14,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
14 file://0001-Do-not-write-bindir-into-pkg-config-files.patch \ 14 file://0001-Do-not-write-bindir-into-pkg-config-files.patch \
15 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \ 15 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
16 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ 16 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
17 file://0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch \
17 " 18 "
18SRC_URI:append:class-native = " file://relocate-modules.patch" 19SRC_URI:append:class-native = " file://relocate-modules.patch"
19 20