From patchwork Thu May 28 08:23:51 2015 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: 477479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on bilbo.ozlabs.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS autolearn=disabled version=3.4.1 X-Original-To: jk@ozlabs.org Delivered-To: jk@ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id DCCD5140129 for ; Thu, 28 May 2015 18:24:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BEFFF8FFB2; Thu, 28 May 2015 08:24:10 +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 yA2ZCSlLUC9q; Thu, 28 May 2015 08:24:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id A423F8FE68; Thu, 28 May 2015 08:24:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 0BD561C1FAC for ; Thu, 28 May 2015 08:24:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 05E46A36A4 for ; Thu, 28 May 2015 08:24:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l9vElB_HOpKO for ; Thu, 28 May 2015 08:24:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx02.posteo.de (mx02.posteo.de [89.146.194.165]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 34F27A35A5 for ; Thu, 28 May 2015 08:24:04 +0000 (UTC) Received: from dovecot03.posteo.de (unknown [185.67.36.28]) by mx02.posteo.de (Postfix) with ESMTPS id 469B925A2113 for ; Thu, 28 May 2015 10:24:01 +0200 (CEST) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3ly29s1HHGz5vNL for ; Thu, 28 May 2015 10:24:00 +0200 (CEST) Received: from nzxt.fritz.box (nzxt.localdomain [192.168.178.46]) (Authenticated sender: joerg.krause@embedded.rocks) by embedded.rocks (Postfix) with ESMTPSA id 0C69B9804D2; Thu, 28 May 2015 10:23:59 +0200 (CEST) From: =?UTF-8?q?J=C3=B6rg=20Krause?= To: buildroot@buildroot.org Date: Thu, 28 May 2015 10:23:51 +0200 Message-Id: <1432801431-16986-1-git-send-email-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.4.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] package/shairport-sync: Add musl patches X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 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" Add patches to fix the following issues: - shairport-sync crashes on musl libc because of a stack overflow - warning about incorrect header includes for poll.h and signal.h Both patches PR'ed upstream: https://github.com/mikebrady/shairport-sync/pull/78 Signed-off-by: Jörg Krause Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- .../0001-Fix-segfault-with-musl-libc.patch | 63 ++++++++++++++++++++++ ...x-redirection-of-incorrect-system-headers.patch | 56 +++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 package/shairport-sync/0001-Fix-segfault-with-musl-libc.patch create mode 100644 package/shairport-sync/0002-Fix-redirection-of-incorrect-system-headers.patch diff --git a/package/shairport-sync/0001-Fix-segfault-with-musl-libc.patch b/package/shairport-sync/0001-Fix-segfault-with-musl-libc.patch new file mode 100644 index 0000000..7307729 --- /dev/null +++ b/package/shairport-sync/0001-Fix-segfault-with-musl-libc.patch @@ -0,0 +1,63 @@ +From e12d7ad23ee3c40b61c31543737dd1b929e08a53 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Thu, 28 May 2015 09:10:59 +0200 +Subject: [PATCH 1/1] Fix segfault with musl libc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +shairport-sync crashes on musl libc when accessing the `statistics` array in +`player_thread_func()`. This array is quite large (60128 bytes) and the data +for this thread exceed the the default stack size on musl libc of 80k [1]. + +Safe and portable programs should not depend upon the default stack limit, but +instead, explicitly allocate enough stack for each thread by using the +pthread_attr_setstacksize routine [2]. + +So, lets set the stack size for the `player_thread` to 128k. A follow-up patch +may set the stack sizes for the other threads, too. The difficulty here is to +decide how much memory to allocate for the stack. + +[1] +http://wiki.musl-libc.org/wiki/Functional_differences_from_glibc#Thread_stack_size + +[2] +https://computing.llnl.gov/tutorials/pthreads/#Stack + +Signed-off-by: Jörg Krause +--- + player.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/player.c b/player.c +index fcca348..561c3f2 100644 +--- a/player.c ++++ b/player.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + + #include "config.h" + +@@ -1104,7 +1105,15 @@ int player_play(stream_cfg *stream) { + if (rc) + debug(1,"Error initialising condition variable."); + config.output->start(sampling_rate); +- pthread_create(&player_thread, NULL, player_thread_func, NULL); ++ ++ size_t size = (PTHREAD_STACK_MIN + 128 * 1024); ++ pthread_attr_t tattr; ++ pthread_attr_init(&tattr); ++ rc = pthread_attr_setstacksize(&tattr, size); ++ if (rc) ++ debug(1, "Error setting stack size for player_thread: %s", strerror(errno)); ++ pthread_create(&player_thread, &tattr, player_thread_func, NULL); ++ pthread_attr_destroy(&tattr); + + return 0; + } +-- +2.4.2 + diff --git a/package/shairport-sync/0002-Fix-redirection-of-incorrect-system-headers.patch b/package/shairport-sync/0002-Fix-redirection-of-incorrect-system-headers.patch new file mode 100644 index 0000000..4e48dae --- /dev/null +++ b/package/shairport-sync/0002-Fix-redirection-of-incorrect-system-headers.patch @@ -0,0 +1,56 @@ +From 8a122426c654ce87568b6be78af7e66df4a1b4c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Thu, 28 May 2015 09:54:46 +0200 +Subject: [PATCH 2/2] Fix redirection of incorrect system headers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The POSIX correct header include is `` [1] and `` + +The glibc silently redirects these incorrect includes, musl libc prints +a warning: + #warning redirecting incorrect #include to + #warning redirecting incorrect #include to + +[1] +http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html + +[2] +http://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html + +Signed-off-by: Jörg Krause +--- + player.c | 2 +- + rtsp.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/player.c b/player.c +index 561c3f2..3b28eee 100644 +--- a/player.c ++++ b/player.c +@@ -36,7 +36,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/rtsp.c b/rtsp.c +index 91e0728..379662a 100644 +--- a/rtsp.c ++++ b/rtsp.c +@@ -39,7 +39,7 @@ + #include + #include + #include +-#include ++#include + + #include "config.h" + +-- +2.4.2 +