From 7c12499275fe68ef1b11db60389b9d991674b826 Mon Sep 17 00:00:00 2001 From: jasper Date: Thu, 14 Feb 2008 12:39:15 +0000 Subject: [PATCH] - fix a possible deadlock, from gnome svn ok ajacoutot@ mbalmer@ --- x11/gnome/keyring/Makefile | 4 +- .../keyring/patches/patch-common_gkr-async_c | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 x11/gnome/keyring/patches/patch-common_gkr-async_c diff --git a/x11/gnome/keyring/Makefile b/x11/gnome/keyring/Makefile index 9b2855de5c4..0e2fa7316d3 100644 --- a/x11/gnome/keyring/Makefile +++ b/x11/gnome/keyring/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.21 2008/02/04 17:55:18 jasper Exp $ +# $OpenBSD: Makefile,v 1.22 2008/02/14 12:39:15 jasper Exp $ COMMENT= password agent for the GNOME project GNOME_PROJECT= gnome-keyring GNOME_VERSION= 2.21.5 SHARED_LIBS += gnome-keyring 3.0 # .1.1 -PKGNAME= ${DISTNAME}p0 +PKGNAME= ${DISTNAME}p1 # GPL/LGPL PERMIT_PACKAGE_CDROM= Yes diff --git a/x11/gnome/keyring/patches/patch-common_gkr-async_c b/x11/gnome/keyring/patches/patch-common_gkr-async_c new file mode 100644 index 00000000000..36224d50a41 --- /dev/null +++ b/x11/gnome/keyring/patches/patch-common_gkr-async_c @@ -0,0 +1,52 @@ +$OpenBSD: patch-common_gkr-async_c,v 1.1 2008/02/14 12:39:15 jasper Exp $ +--- common/gkr-async.c.orig Thu Feb 14 00:03:24 2008 ++++ common/gkr-async.c Thu Feb 14 00:16:53 2008 +@@ -34,6 +34,11 @@ + + #define DEBUG_LOCKS 0 + ++/* ++ * See comments on async_poll_func() on the order of the various ++ * gets and sets of waiting_on_* flags. ++ */ ++ + #if DEBUG_LOCKS + #define DO_LOCK(mtx) G_STMT_START { \ + g_printerr ("%s LOCK %s\n", __func__, G_STRINGIFY(mtx)); \ +@@ -93,8 +98,20 @@ async_poll_func (GPollFD *ufds, guint nfsd, gint timeo + gint ret; + + g_assert (orig_poll_func); ++ ++ /* ++ * These two atomic variables are interlocked in the ++ * opposite order from those in DO_LOCK which prevents ++ * race conditions in the if statements. ++ */ + g_atomic_int_set (&waiting_on_poll, 1); ++ ++ if (g_atomic_int_get (&waiting_on_lock)) ++ ++ timeout = 0; ++ + ret = (orig_poll_func) (ufds, nfsd, timeout); ++ + g_atomic_int_set (&waiting_on_poll, 0); + + if (done_queue && !g_queue_is_empty (done_queue)) +@@ -314,7 +331,6 @@ cleanup_done_thread (gpointer message, gpointer data) + running_workers = NULL; + + g_assert (main_loop); +- gkr_wakeup_register (g_main_loop_get_context (main_loop)); + return FALSE; + } + +@@ -346,7 +362,6 @@ gkr_async_worker_start (GThreadFunc func, GkrAsyncWork + + if (!done_queue) { + g_assert (main_loop); +- gkr_wakeup_register (g_main_loop_get_context (main_loop)); + + done_queue = g_queue_new (); + g_assert (!running_workers);