From patchwork Thu Nov 19 19:50:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Barnett X-Patchwork-Id: 546655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id B5A1B14144B for ; Fri, 20 Nov 2015 06:50:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 26E4132F6E; Thu, 19 Nov 2015 19:50:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XwwNL3307pOF; Thu, 19 Nov 2015 19:50:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5E89832F57; Thu, 19 Nov 2015 19:50:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 8007F1C1641 for ; Thu, 19 Nov 2015 19:50:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7E35094A84 for ; Thu, 19 Nov 2015 19:50:42 +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 4y7km7bATITW for ; Thu, 19 Nov 2015 19:50:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from secvs02.rockwellcollins.com (secvs02.rockwellcollins.com [205.175.225.241]) by hemlock.osuosl.org (Postfix) with ESMTPS id 63ED1949CA for ; Thu, 19 Nov 2015 19:50:39 +0000 (UTC) Received: from ofwgwc03.rockwellcollins.com (HELO dtulimr01.rockwellcollins.com) ([205.175.225.12]) by secvs02.rockwellcollins.com with ESMTP; 19 Nov 2015 13:50:37 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id 8CCF6602A3; Thu, 19 Nov 2015 13:50:37 -0600 (CST) From: Ryan Barnett To: buildroot@buildroot.org Date: Thu, 19 Nov 2015 13:50:31 -0600 Message-Id: <1447962631-60866-1-git-send-email-ryan.barnett@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 Cc: Thomas Petazzoni , Ryan Barnett Subject: [Buildroot] [PATCH] openssl: fix race condition when symlink shared libs 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The build-shared target depends on do_crypto and link-shared, which will be executed in parallel. do_crypto calls link_a.linux_shared -> link_a.gnu which does SYMLINK_SO; in parallel, link-shared calls symlink.linux_shared which also does SYMLINK_SO. Before the symlink is created, it is rm'ed, but there is a tiny chance that the second one is created after the rm has been called. Fix this by using 'ln -sf' instead of 'ln -s' so the build doesn't error out. Patch submitted upstream at: https://bugs.gentoo.org/show_bug.cgi?id=566260 Thanks to Arnout for explain the issue (wording used above). Signed-off-by: Ryan Barnett CC: Arnout Vandecappelle CC: Thomas Petazzoni --- Note this is a temporary fix until a gentoo maintainer weighs in and updates their parallel build patch. Signed-off-by: Ryan Barnett --- ...ared-fix-race-condition-when-symlinking-s.patch | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 package/openssl/0003-makefile.shared-fix-race-condition-when-symlinking-s.patch diff --git a/package/openssl/0003-makefile.shared-fix-race-condition-when-symlinking-s.patch b/package/openssl/0003-makefile.shared-fix-race-condition-when-symlinking-s.patch new file mode 100644 index 0000000..fd39723 --- /dev/null +++ b/package/openssl/0003-makefile.shared-fix-race-condition-when-symlinking-s.patch @@ -0,0 +1,45 @@ +From bcea66251e8014c12db81ff54f419fe82b6f8527 Mon Sep 17 00:00:00 2001 +From: Ryan Barnett +Date: Thu, 19 Nov 2015 10:47:00 -0600 +Subject: [PATCH] makefile.shared: fix race condition when symlinking shared + libs + +The build-shared target depends on do_crypto and link-shared, which +will be executed in parallel. do_crypto calls +link_a.linux_shared -> link_a.gnu which does SYMLINK_SO; in parallel, +link-shared calls symlink.linux_shared which also does SYMLINK_SO. +Before the symlink is created, it is rm'ed, but there is a tiny chance +that the second one is created after the rm has been called. + +Fix this race condition by just using ln -sf since it will be the same +symlink regards and not cause the build to error out. + +Signed-off-by: Ryan Barnett +--- + Makefile.shared | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.shared b/Makefile.shared +index 8d57163..ce66574 100644 +--- a/Makefile.shared ++++ b/Makefile.shared +@@ -118,14 +118,14 @@ SYMLINK_SO= \ + if [ -n "$$SHLIB_COMPAT" ]; then \ + for x in $$SHLIB_COMPAT; do \ + ( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \ +- ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \ ++ ln -sf $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \ + prev=$$SHLIB$$x$$SHLIB_SUFFIX; \ + done; \ + fi; \ + if [ -n "$$SHLIB_SOVER" ]; then \ + [ -e "$$SHLIB$$SHLIB_SUFFIX" ] || \ + ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \ +- ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \ ++ ln -sf $$prev $$SHLIB$$SHLIB_SUFFIX ); \ + fi; \ + fi + +-- +1.9.1 +