From patchwork Sun Dec 10 18:16:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waldemar Brodkorb X-Patchwork-Id: 846691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yvvSW1RLpz9t3Z for ; Mon, 11 Dec 2017 05:16:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A565781511; Sun, 10 Dec 2017 18:16:17 +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 2DOeEngZlwVk; Sun, 10 Dec 2017 18:16:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id D9740888C2; Sun, 10 Dec 2017 18:16:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 401C61C0427 for ; Sun, 10 Dec 2017 18:16:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3B40D2D75F for ; Sun, 10 Dec 2017 18:16:13 +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 h-VnQlX4w5Wf for ; Sun, 10 Dec 2017 18:16:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) by silver.osuosl.org (Postfix) with ESMTPS id 988C329DC1 for ; Sun, 10 Dec 2017 18:16:09 +0000 (UTC) Received: by helium.openadk.org (Postfix, from userid 1000) id 75EE11073C; Sun, 10 Dec 2017 19:16:06 +0100 (CET) Date: Sun, 10 Dec 2017 19:16:06 +0100 From: Waldemar Brodkorb To: buildroot@buildroot.org Message-ID: <20171210181606.GA27756@waldemar-brodkorb.de> MIME-Version: 1.0 Content-Disposition: inline X-Operating-System: Linux 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [Buildroot] [PATCH] libressl: enable for noMMU X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 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" We need to use pthread_atfork for Linuxthreads. Add a check if fork() is available, otherwise use vfork(). Signed-off-by: Waldemar Brodkorb --- package/libressl/0003-uclibc-linuxthreads.patch | 12 ++++++ package/libressl/0004-uclibc-fork.patch | 52 +++++++++++++++++++++++++ package/openssl/Config.in | 2 - 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 package/libressl/0003-uclibc-linuxthreads.patch create mode 100644 package/libressl/0004-uclibc-fork.patch diff --git a/package/libressl/0003-uclibc-linuxthreads.patch b/package/libressl/0003-uclibc-linuxthreads.patch new file mode 100644 index 0000000000..4ea702e5fa --- /dev/null +++ b/package/libressl/0003-uclibc-linuxthreads.patch @@ -0,0 +1,12 @@ +diff -Nur libressl-2.6.3.orig/crypto/compat/arc4random_linux.h libressl-2.6.3/crypto/compat/arc4random_linux.h +--- libressl-2.6.3.orig/crypto/compat/arc4random_linux.h 2017-11-06 00:15:17.000000000 +0100 ++++ libressl-2.6.3/crypto/compat/arc4random_linux.h 2017-12-02 02:12:55.407388811 +0100 +@@ -32,7 +32,7 @@ + #define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) + #define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + +-#ifdef __GLIBC__ ++#if defined __GLIBC__ && !defined __UCLIBC_HAS_LINUXTHREADS__ + extern void *__dso_handle; + extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *); + #define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle) diff --git a/package/libressl/0004-uclibc-fork.patch b/package/libressl/0004-uclibc-fork.patch new file mode 100644 index 0000000000..ef654b29db --- /dev/null +++ b/package/libressl/0004-uclibc-fork.patch @@ -0,0 +1,52 @@ +diff -Nur libressl-2.6.3.orig/apps/openssl/speed.c libressl-2.6.3/apps/openssl/speed.c +--- libressl-2.6.3.orig/apps/openssl/speed.c 2017-03-07 06:43:54.000000000 +0100 ++++ libressl-2.6.3/apps/openssl/speed.c 2017-12-06 19:39:39.284165670 +0100 +@@ -144,6 +144,12 @@ + #include + #endif + ++#if WANT_FORK ++#define v_or_fork() fork() ++#else ++#define v_or_fork() vfork() ++#endif ++ + #include "./testdsa.h" + #include "./testrsa.h" + +@@ -1995,7 +2001,7 @@ + } + fflush(stdout); + fflush(stderr); +- if (fork()) { ++ if (v_or_fork()) { + close(fd[1]); + fds[n] = fd[0]; + } else { +diff -Nur libressl-2.6.3.orig/configure.ac libressl-2.6.3/configure.ac +--- libressl-2.6.3.orig/configure.ac 2017-11-04 21:04:56.000000000 +0100 ++++ libressl-2.6.3/configure.ac 2017-12-06 19:38:06.416277421 +0100 +@@ -48,6 +48,23 @@ + # Check if funopen exists + AC_CHECK_FUNC([funopen]) + ++AC_ARG_ENABLE([fork], ++[ --disable-fork disable use of fork], ++ use_fork=$enableval, use_fork=yes) ++test x"$use_fork" = x"no" && ac_cv_func_fork=no ++AC_CHECK_FUNCS([fork unsetenv]) ++case $use_fork:$ac_cv_func_fork in ++no:*) use_fork=0 ;; ++*:yes) use_fork=1 ;; ++*) use_fork=0 ;; ++esac ++AC_DEFINE_UNQUOTED([WANT_FORK], [$use_fork], [We have fork(2) and want to use it]) ++if test $use_fork = 1; then ++ echo "Enabling use of fork()" ++else ++ echo "Disabling use of fork() (NOMMU)!" ++fi ++ + CHECK_LIBC_COMPAT + CHECK_SYSCALL_COMPAT + CHECK_CRYPTO_COMPAT diff --git a/package/openssl/Config.in b/package/openssl/Config.in index d84033141f..e33320afc5 100644 --- a/package/openssl/Config.in +++ b/package/openssl/Config.in @@ -48,8 +48,6 @@ endif config BR2_PACKAGE_LIBRESSL bool "libressl" depends on !BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL - # uClibc on noMMU doesn't provide __register_atfork() - depends on !(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_USE_MMU) help LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, with goals of modernizing the codebase,