Merge remote-tracking branch 'up/f31' into master-riscv64

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
David Abdurachmanov 2019-09-21 16:36:41 +03:00
commit fb21f54471
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
3 changed files with 36 additions and 147 deletions

View File

@ -1,136 +0,0 @@
From d26b66e225d3f0d308b2ec1a862a505709076bf7 Mon Sep 17 00:00:00 2001
From: Arnaud Rebillout <elboulangero@gmail.com>
Date: Sun, 10 Jun 2018 20:56:12 +0700
Subject: [PATCH] gfdonotificationbackend: Fix possible invalid pointer in dbus
callback
The way things were before: a FreedesktopNotification struct is
allocated before the dbus call, and this same struct is possibly re-used
for other dbus calls. If the server becomes unavailable, the callback
will be invoked after the call times out, which leaves a long time where
other dbus calls can happen, re-using the same FreedesktopNotification
as user data. When the first call times out, the callback is invoked,
and the user data is freed. Subsequent calls that used the same user
data will time out later on, and try to free a pointer that was already
freed, hence segfaults.
This bug can be reproduced in Cinnamon 3.6.7, as mentioned in:
<https://github.com/linuxmint/Cinnamon/issues/7491>
This commit fixes that by always allocating a new
FreedesktopNotification before invoking dbus_call(), ensuring that the
callback always have a valid user data.
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
---
gio/gfdonotificationbackend.c | 55 ++++++++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 21 deletions(-)
diff --git a/gio/gfdonotificationbackend.c b/gio/gfdonotificationbackend.c
index a0d4814335be..ab5329497d1e 100644
--- a/gio/gfdonotificationbackend.c
+++ b/gio/gfdonotificationbackend.c
@@ -62,7 +62,6 @@ typedef struct
GVariant *default_action_target;
} FreedesktopNotification;
-
static void
freedesktop_notification_free (gpointer data)
{
@@ -76,6 +75,24 @@ freedesktop_notification_free (gpointer data)
g_slice_free (FreedesktopNotification, n);
}
+static FreedesktopNotification *
+freedesktop_notification_new (GFdoNotificationBackend *backend,
+ const gchar *id,
+ GNotification *notification)
+{
+ FreedesktopNotification *n;
+
+ n = g_slice_new0 (FreedesktopNotification);
+ n->backend = backend;
+ n->id = g_strdup (id);
+ n->notify_id = 0;
+ g_notification_get_default_action (notification,
+ &n->default_action,
+ &n->default_action_target);
+
+ return n;
+}
+
static FreedesktopNotification *
g_fdo_notification_backend_find_notification (GFdoNotificationBackend *backend,
const gchar *id)
@@ -319,8 +336,19 @@ notification_sent (GObject *source_object,
val = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object), result, &error);
if (val)
{
+ GFdoNotificationBackend *backend = n->backend;
+ FreedesktopNotification *match;
+
g_variant_get (val, "(u)", &n->notify_id);
g_variant_unref (val);
+
+ match = g_fdo_notification_backend_find_notification_by_notify_id (backend, n->notify_id);
+ if (match != NULL)
+ {
+ backend->notifications = g_slist_remove (backend->notifications, match);
+ freedesktop_notification_free (match);
+ }
+ backend->notifications = g_slist_prepend (backend->notifications, n);
}
else
{
@@ -331,9 +359,7 @@ notification_sent (GObject *source_object,
warning_printed = TRUE;
}
- n->backend->notifications = g_slist_remove (n->backend->notifications, n);
freedesktop_notification_free (n);
-
g_error_free (error);
}
}
@@ -378,7 +404,7 @@ g_fdo_notification_backend_send_notification (GNotificationBackend *backend,
GNotification *notification)
{
GFdoNotificationBackend *self = G_FDO_NOTIFICATION_BACKEND (backend);
- FreedesktopNotification *n;
+ FreedesktopNotification *n, *tmp;
if (self->notify_subscription == 0)
{
@@ -391,24 +417,11 @@ g_fdo_notification_backend_send_notification (GNotificationBackend *backend,
notify_signal, backend, NULL);
}
- n = g_fdo_notification_backend_find_notification (self, id);
- if (n == NULL)
- {
- n = g_slice_new0 (FreedesktopNotification);
- n->backend = self;
- n->id = g_strdup (id);
- n->notify_id = 0;
-
- n->backend->notifications = g_slist_prepend (n->backend->notifications, n);
- }
- else
- {
- /* Only clear default action. All other fields are still valid */
- g_clear_pointer (&n->default_action, g_free);
- g_clear_pointer (&n->default_action_target, g_variant_unref);
- }
+ n = freedesktop_notification_new (self, id, notification);
- g_notification_get_default_action (notification, &n->default_action, &n->default_action_target);
+ tmp = g_fdo_notification_backend_find_notification (self, id);
+ if (tmp)
+ n->notify_id = tmp->notify_id;
call_notify (backend->dbus_connection, backend->application, n->notify_id, notification, notification_sent, n);
}
--
2.14.4

View File

@ -1,13 +1,13 @@
%global _changelog_trimtime %(date +%s -d "1 year ago")
Name: glib2
Version: 2.60.0
Release: 3.0.riscv64%{?dist}
Version: 2.62.0
Release: 1.0.riscv64%{?dist}
Summary: A library of handy utility functions
License: LGPLv2+
URL: http://www.gtk.org
Source0: http://download.gnome.org/sources/glib/2.60/glib-%{version}.tar.xz
Source0: http://download.gnome.org/sources/glib/2.62/glib-%{version}.tar.xz
Patch0: glib-2.60.0-disable-tests.patch
@ -111,8 +111,8 @@ rm glib/pcre/*.[ch]
# better reproducibility.
# Also copy the timestamp for other .py files, because meson doesn't
# do this, see https://github.com/mesonbuild/meson/issues/5027.
touch -r gio/gdbus-2.0/codegen/config.py.in $RPM_BUILD_ROOT/%{_datadir}/glib-2.0/codegen/*.py
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so
touch -r gio/gdbus-2.0/codegen/config.py.in %{buildroot}%{_datadir}/glib-2.0/codegen/*.py
chrpath --delete %{buildroot}%{_libdir}/*.so
# Perform byte compilation manually to avoid issues with
# irreproducibility of the default invalidation mode, see
@ -121,12 +121,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so
export PYTHONHASHSEED=0
%py_byte_compile %{__python3} %{buildroot}%{_datadir}
mv $RPM_BUILD_ROOT%{_bindir}/gio-querymodules $RPM_BUILD_ROOT%{_bindir}/gio-querymodules-%{__isa_bits}
mv %{buildroot}%{_bindir}/gio-querymodules %{buildroot}%{_bindir}/gio-querymodules-%{__isa_bits}
touch $RPM_BUILD_ROOT%{_libdir}/gio/modules/giomodule.cache
# bash-completion scripts need not be executable
chmod 644 $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/*
touch %{buildroot}%{_libdir}/gio/modules/giomodule.cache
%find_lang glib20
@ -232,6 +229,34 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
* Sat Mar 23 2019 David Abdurachmanov <david.abdurachmanov@gmail.com> - 2.60.0-3.0.riscv64
- Disable tests subpackage on RISC-V (riscv64)
* Fri Sep 06 2019 Kalev Lember <klember@redhat.com> - 2.62.0-1
- Update to 2.62.0
* Tue Sep 03 2019 Kalev Lember <klember@redhat.com> - 2.61.3-1
- Update to 2.61.3
* Mon Aug 12 2019 Kalev Lember <klember@redhat.com> - 2.61.2-1
- Update to 2.61.2
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.61.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue Jun 11 2019 David King <amigadave@amigadave.com> - 2.61.1-2
- Fix CVE-2019-12450 (#1719142)
- Consistently use buildroot macro
* Fri May 24 2019 Kalev Lember <klember@redhat.com> - 2.61.1-1
- Update to 2.61.1
* Tue Apr 16 2019 Adam Williamson <awilliam@redhat.com> - 2.61.0-2
- Rebuild with Meson fix for #1699099
* Mon Apr 15 2019 Kalev Lember <klember@redhat.com> - 2.61.0-1
- Update to 2.61.0
* Mon Apr 15 2019 Kalev Lember <klember@redhat.com> - 2.60.1-1
- Update to 2.60.1
* Wed Mar 13 2019 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.60.0-3
- Switch back to timestamp-based pyc invalidation mode

View File

@ -1 +1 @@
SHA512 (glib-2.60.0.tar.xz) = 8184371aa5a8936ef86e578ee66307dadc351203ad0773c7669ab6d3f6bca49e7391ccafeb624d7bfe67f0d9aafe72799defee4660f254c3a3013c752e897e6c
SHA512 (glib-2.62.0.tar.xz) = 4a880f9cc0209e99e814c4ef0adf3ef82ec5cca413ebb3e6d2da17768b7099744ca57f0a86b5aeb443c8ee0b663581ddb8bb577fa7bcc645bd64817b39991d63