From 5617dd0c81a5a35a0beef3aa12e736a48f3abcd1 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 30 Jul 2019 08:45:25 +0000 Subject: user/gamin: fix deadlock on at least arm64 --- user/gamin/APKBUILD | 15 +++++------ user/gamin/deadlock.patch | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 user/gamin/deadlock.patch (limited to 'user/gamin') diff --git a/user/gamin/APKBUILD b/user/gamin/APKBUILD index a53174220..b7d0461fc 100644 --- a/user/gamin/APKBUILD +++ b/user/gamin/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: pkgname=gamin pkgver=0.1.10 -pkgrel=12 +pkgrel=13 pkgdesc="Library for file and directory monitoring" url="http://www.gnome.org/~veillard/gamin" arch="all" @@ -9,18 +9,18 @@ license="LGPL-2.0+" subpackages="$pkgname-dev" depends="" makedepends="glib-dev" -source="http://www.gnome.org/~veillard/$pkgname/sources/$pkgname-$pkgver.tar.gz +source="https://www.gnome.org/~veillard/$pkgname/sources/$pkgname-$pkgver.tar.gz fix-deprecated-const.patch - fix-pthread-mutex.patch" + fix-pthread-mutex.patch + deadlock.patch + " prepare() { - cd "$builddir" update_config_sub default_prepare } build() { - cd "$builddir" ./configure \ --build=$CBUILD \ --host=$CHOST \ @@ -35,16 +35,15 @@ build() { } check() { - cd "$builddir" make check } package() { - cd "$builddir" export MKDIRPROG="mkdir -p" make DESTDIR="$pkgdir" install } sha512sums="21bfe6fcf8fb3117cd5a08c8ce3b8d0d1dd23e478e60a95b76c20d02cc29b050dde086578d81037990484ff891c3e104d2cbbf3d294b4a79346b14a0cae075bb gamin-0.1.10.tar.gz c4c10bee70c7231db395cbfe5bdf513ade6be599a11a9d35888ddfaca42d619fe2b5e87c2b2bab469ea98ba718bc01711252313ba5f53c392379b669f5b2902b fix-deprecated-const.patch -70628fc39521ea8bc4a40b009d0881f6ee540334a31b2f0cb67dde0f75808c69feb78088ad24c3c4a0dec9fa59e87960fd81d1a2e56963ce9268d0a5e14f88e8 fix-pthread-mutex.patch" +70628fc39521ea8bc4a40b009d0881f6ee540334a31b2f0cb67dde0f75808c69feb78088ad24c3c4a0dec9fa59e87960fd81d1a2e56963ce9268d0a5e14f88e8 fix-pthread-mutex.patch +183bb2188fadc32c47ceab8c7fe339e7485c9a57f892b011179ae2be64a16f92e031fcdf2a55959a08c482a82adbad0f3270d1df7441532d0bdffa786ba1de94 deadlock.patch" diff --git a/user/gamin/deadlock.patch b/user/gamin/deadlock.patch new file mode 100644 index 000000000..8bc6e40bf --- /dev/null +++ b/user/gamin/deadlock.patch @@ -0,0 +1,65 @@ +From f9c67a13af33f389429e4e760f2023a23a9ac19f Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Wed, 4 Jan 2012 00:23:55 +0200 +Subject: [PATCH 4/4] fix possible server deadlock in ih_sub_cancel + +ih_sub_foreach() calls ih_sub_cancel() while inotify_lock is locked. +However, ih_sub_cancel() locks it again, and locking GMutex recursively +causes undefined behaviour. + +Fix that by removing locking from ih_sub_cancel() as ih_sub_foreach() +is its only user. Also make the function static so that it won't +accidentally get used by other files without locking (inotify-helper.h +is an internal server header). + +This should fix the intermittent deadlocks I've been experiencing +causing KDE applications to no longer start, and probably also +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542361 +--- + server/inotify-helper.c | 7 ++----- + server/inotify-helper.h | 1 - + 2 files changed, 2 insertions(+), 6 deletions(-) + +diff --git a/server/inotify-helper.c b/server/inotify-helper.c +index d77203e..0789fa4 100644 +--- a/server/inotify-helper.c ++++ b/server/inotify-helper.c +@@ -123,13 +123,11 @@ ih_sub_add (ih_sub_t * sub) + + /** + * Cancels a subscription which was being monitored. ++ * inotify_lock must be held when calling. + */ +-gboolean ++static gboolean + ih_sub_cancel (ih_sub_t * sub) + { +- G_LOCK(inotify_lock); +- +- + if (!sub->cancelled) + { + IH_W("cancelling %s\n", sub->pathname); +@@ -140,7 +138,6 @@ ih_sub_cancel (ih_sub_t * sub) + sub_list = g_list_remove (sub_list, sub); + } + +- G_UNLOCK(inotify_lock); + return TRUE; + } + +diff --git a/server/inotify-helper.h b/server/inotify-helper.h +index 5d3b6d0..d36b5fd 100644 +--- a/server/inotify-helper.h ++++ b/server/inotify-helper.h +@@ -34,7 +34,6 @@ gboolean ih_startup (event_callback_t ecb, + found_callback_t fcb); + gboolean ih_running (void); + gboolean ih_sub_add (ih_sub_t *sub); +-gboolean ih_sub_cancel (ih_sub_t *sub); + + /* Return FALSE from 'f' if the subscription should be cancelled */ + void ih_sub_foreach (void *callerdata, gboolean (*f)(ih_sub_t *sub, void *callerdata)); +-- +2.5.0 + -- cgit v1.2.3-70-g09d2