From patchwork Thu May 9 11:04:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rg_Krause?= X-Patchwork-Id: 1097457 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=embedded.rocks Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4509Ty08QWz9s7h for ; Thu, 9 May 2019 21:04:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 42E0D88293; Thu, 9 May 2019 11:04:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XlDyW1ssD-us; Thu, 9 May 2019 11:04:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 91E648828D; Thu, 9 May 2019 11:04:50 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 969101BF35C for ; Thu, 9 May 2019 11:04:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 935D7827BD for ; Thu, 9 May 2019 11:04:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zGzJgKaD13UG for ; Thu, 9 May 2019 11:04:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9427487057 for ; Thu, 9 May 2019 11:04:48 +0000 (UTC) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 080B02400FD for ; Thu, 9 May 2019 13:04:44 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4509Tl5z3lz9rxS for ; Thu, 9 May 2019 13:04:43 +0200 (CEST) Received: from mail.embedded.rocks ([127.0.0.1]) by localhost (mail.embedded.rocks [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id YEzXy22m08TC; Thu, 9 May 2019 13:04:42 +0200 (CEST) Received: from nzxt.fritz.box (port-92-193-221-66.dynamic.qsc.de [92.193.221.66]) (Authenticated sender: joerg.krause@embedded.rocks) by mail.embedded.rocks (Postfix) with ESMTPSA; Thu, 9 May 2019 13:04:42 +0200 (CEST) From: =?utf-8?q?J=C3=B6rg_Krause?= To: buildroot@buildroot.org Date: Thu, 9 May 2019 13:04:38 +0200 Message-Id: <20190509110438.31340-2-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509110438.31340-1-joerg.krause@embedded.rocks> References: <20190509110438.31340-1-joerg.krause@embedded.rocks> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/2] package/libupnp18: add upstream patch to fix runtime crash with musl X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Applications build with a musl 1.1.20+ toolchain and linked with libupnpp will crash at runtime with `Illegal instruction` as musl is more strict with trying to detach an already detached thread resulting in undefined behaviour. Upstream status: https://github.com/mrjimenez/pupnp/issues/102 Backported from: https://github.com/mrjimenez/pupnp/commit/04b454f693d0c71336252380d08f1d02967e133e Signed-off-by: Jörg Krause --- ...tach-detached-thread-the-result-is-u.patch | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 package/libupnp18/0002-Do-not-try-to-detach-detached-thread-the-result-is-u.patch diff --git a/package/libupnp18/0002-Do-not-try-to-detach-detached-thread-the-result-is-u.patch b/package/libupnp18/0002-Do-not-try-to-detach-detached-thread-the-result-is-u.patch new file mode 100644 index 0000000000..601ea89be7 --- /dev/null +++ b/package/libupnp18/0002-Do-not-try-to-detach-detached-thread-the-result-is-u.patch @@ -0,0 +1,39 @@ +From 04b454f693d0c71336252380d08f1d02967e133e Mon Sep 17 00:00:00 2001 +From: Jean-Francois Dockes +Date: Sun, 27 Jan 2019 10:44:17 +0100 +Subject: [PATCH] Do not try to detach detached thread, the result is + undefined. Fixes issue #102 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes runtime crash with musl 1.1.20+. The problem is that libupnp is +calling pthread_detach() on a thread which was created in the detached state. + +Backported from: 04b454f693d0c71336252380d08f1d02967e133e + +(cherry picked from commit 386b7ed79146ecf7a3bba49f48cb8f41a9b49170) +Signed-off-by: Jörg Krause +--- + upnp/src/threadutil/ThreadPool.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/upnp/src/threadutil/ThreadPool.c b/upnp/src/threadutil/ThreadPool.c +index d272907..5e590ed 100644 +--- a/upnp/src/threadutil/ThreadPool.c ++++ b/upnp/src/threadutil/ThreadPool.c +@@ -651,11 +651,6 @@ static int CreateWorker( + rc = ithread_create(&temp, &attr, WorkerThread, tp); + ithread_attr_destroy(&attr); + if (rc == 0) { +- rc = ithread_detach(temp); +- /* ithread_detach will return EINVAL if thread has been +- successfully detached by ithread_create */ +- if (rc == EINVAL) +- rc = 0; + tp->pendingWorkerThreadStart = 1; + /* wait until the new worker thread starts */ + while (tp->pendingWorkerThreadStart) { +-- +2.21.0 +