summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-04-03 05:44:45 +0000
committerMike Frysinger <vapier@gentoo.org>2015-04-03 05:44:45 +0000
commit5eb8567566a360ec4214262522cd42bbe52bea7d (patch)
treef95536446d0f834f2eb6eec6bc1d0f0e910a01da
parentClean up patches. (diff)
downloadgentoo-2-5eb8567566a360ec4214262522cd42bbe52bea7d.tar.gz
gentoo-2-5eb8567566a360ec4214262522cd42bbe52bea7d.tar.bz2
gentoo-2-5eb8567566a360ec4214262522cd42bbe52bea7d.zip
Fix parallel build wrt symlinking of generated libs #545028 by Martin von Gagern.
(Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key D2E96200)
-rw-r--r--dev-libs/openssl/ChangeLog7
-rw-r--r--dev-libs/openssl/files/openssl-1.0.2a-parallel-symlinking.patch61
-rw-r--r--dev-libs/openssl/openssl-1.0.2a.ebuild3
3 files changed, 69 insertions, 2 deletions
diff --git a/dev-libs/openssl/ChangeLog b/dev-libs/openssl/ChangeLog
index a4aace73a5f9..15c7bd08c686 100644
--- a/dev-libs/openssl/ChangeLog
+++ b/dev-libs/openssl/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for dev-libs/openssl
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/ChangeLog,v 1.646 2015/04/03 05:43:32 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/ChangeLog,v 1.647 2015/04/03 05:44:45 vapier Exp $
+
+ 03 Apr 2015; Mike Frysinger <vapier@gentoo.org>
+ +files/openssl-1.0.2a-parallel-symlinking.patch, openssl-1.0.2a.ebuild:
+ Fix parallel build wrt symlinking of generated libs #545028 by Martin von
+ Gagern.
02 Apr 2015; Mike Frysinger <vapier@gentoo.org> openssl-1.0.2a.ebuild,
files/openssl-1.0.2a-parallel-build.patch,
diff --git a/dev-libs/openssl/files/openssl-1.0.2a-parallel-symlinking.patch b/dev-libs/openssl/files/openssl-1.0.2a-parallel-symlinking.patch
new file mode 100644
index 000000000000..d894f2c87e5f
--- /dev/null
+++ b/dev-libs/openssl/files/openssl-1.0.2a-parallel-symlinking.patch
@@ -0,0 +1,61 @@
+From cc81af135bda47eaa6956a0329cbbc55bf993ac1 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 3 Apr 2015 01:16:23 -0400
+Subject: [PATCH] fix race when symlink shareds libs
+
+When the crypto/ssl targets attempt to build their shared libs, they run:
+ cd ..; make libcrypto.so.1.0.0
+The top level Makefile in turn runs the build-shared target for that lib.
+
+The build-shared target depends on both do_$(SHLIB_TARGET) & link-shared.
+When building in parallel, make is allowed to run both of these. They
+both run Makefile.shared for their respective targets:
+do_$(SHLIB_TARGET) ->
+ link_a.linux-shared ->
+ link_a.gnu ->
+ ...; $(LINK_SO_A) ->
+ $(LINK_SO) ->
+ $(SYMLINK_SO)
+link-shared ->
+ symlink.linux-shared ->
+ symlink.gnu ->
+ ...; $(SYMLINK_SO)
+
+The shell code for SYMLINK_SO attempts to do a [ -e lib ] check, but fails
+basic TOCTOU semantics. Depending on the load, that means two processes
+will run the sequence:
+ rm -f libcrypto.so
+ ln -s libcrypto.so.1.0.0 libcrypto.so
+
+Which obviously fails:
+ ln: failed to create symbolic link 'libcrypto.so': File exists
+
+Since we know do_$(SHLIB_TARGET) will create the symlink for us, don't
+bother depending on link-shared at all in the top level Makefile when
+building things.
+
+Reported-by: Martin von Gagern <Martin.vGagern@gmx.net>
+URL: https://bugs.gentoo.org/545028
+---
+ Makefile.org | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.org b/Makefile.org
+index 890bfe4..576c60e 100644
+--- a/Makefile.org
++++ b/Makefile.org
+@@ -350,7 +350,10 @@ link-shared:
+ libs="$$libs -l$$i"; \
+ done
+
+-build-shared: do_$(SHLIB_TARGET) link-shared
++# The link target in Makefile.shared will create the symlink for us, so no need
++# to call link-shared directly. Doing so will cause races with two processes
++# trying to symlink the lib.
++build-shared: do_$(SHLIB_TARGET)
+
+ do_$(SHLIB_TARGET):
+ @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
+--
+2.3.4
+
diff --git a/dev-libs/openssl/openssl-1.0.2a.ebuild b/dev-libs/openssl/openssl-1.0.2a.ebuild
index 6539d343081d..86acfdea4f06 100644
--- a/dev-libs/openssl/openssl-1.0.2a.ebuild
+++ b/dev-libs/openssl/openssl-1.0.2a.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/openssl-1.0.2a.ebuild,v 1.8 2015/04/03 05:43:32 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/openssl-1.0.2a.ebuild,v 1.9 2015/04/03 05:44:45 vapier Exp $
EAPI="4"
@@ -62,6 +62,7 @@ src_prepare() {
epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-build.patch
epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-obj-headers.patch
epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-install-dirs.patch
+ epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-symlinking.patch #545028
epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
epatch "${FILESDIR}"/${PN}-1.0.2-s_client-verify.patch #472584
epatch "${FILESDIR}"/${P}-malloc-typo.patch #543828