From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GDE0IwFbIGDmNAAA0tVLHw (envelope-from ) for ; Sun, 07 Feb 2021 21:26:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WBrYHgFbIGCDGQAA1q6Kng (envelope-from ) for ; Sun, 07 Feb 2021 21:26:25 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9C1759403D6 for ; Sun, 7 Feb 2021 21:26:24 +0000 (UTC) Received: from localhost ([::1]:43544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8rZX-0003HE-34 for larch@yhetil.org; Sun, 07 Feb 2021 16:26:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8rZD-0003Gr-Ex for bug-guix@gnu.org; Sun, 07 Feb 2021 16:26:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37467) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8rZD-0001dB-5z for bug-guix@gnu.org; Sun, 07 Feb 2021 16:26:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l8rZB-0008J9-QZ; Sun, 07 Feb 2021 16:26:01 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#46330: Guile-provided GMP allocators interfere with GnuTLS Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 07 Feb 2021 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46330 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 46330@debbugs.gnu.org Received: via spool by 46330-submit@debbugs.gnu.org id=B46330.161273310931869 (code B ref 46330); Sun, 07 Feb 2021 21:26:01 +0000 Received: (at 46330) by debbugs.gnu.org; 7 Feb 2021 21:25:09 +0000 Received: from localhost ([127.0.0.1]:49012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8rYF-0008Hm-Rd for submit@debbugs.gnu.org; Sun, 07 Feb 2021 16:25:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8rYD-0008HF-TD for 46330@debbugs.gnu.org; Sun, 07 Feb 2021 16:25:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38011) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8rY7-00017E-NG for 46330@debbugs.gnu.org; Sun, 07 Feb 2021 16:24:55 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=48260 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l8rY5-000881-SP for 46330@debbugs.gnu.org; Sun, 07 Feb 2021 16:24:55 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87v9b61md4.fsf@inria.fr> Date: Sun, 07 Feb 2021 22:24:52 +0100 In-Reply-To: <87v9b61md4.fsf@inria.fr> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Fri, 05 Feb 2021 17:59:51 +0100") Message-ID: <87sg67y3iz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.36 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 9C1759403D6 X-Spam-Score: -1.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: Tfcpdl7iQu2H --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s skribis: > In a nutshell, Guile installs its own GMP memory allocation routines > (when =E2=80=98scm_install_gmp_memory_functions=E2=80=99 is true, which i= s the default) > so that GMP allocates via libgc. GnuTLS uses Nettle, which uses GMP, so > Nettle too ends up allocating via libgc; however, since pointers to that > memory are not scanned by libgc, they end up being reclaimed early. For the record, one option I considered is to link GnuTLS against Nettle-with-mini-GMP, whereby Nettle uses a bundled mini-GMP instead of mini-GMP. Another option is to build GnuTLS --with-nettle-mini, where GnuTLS links against a bundled mini-Nettle, instead linked against a bundled mini-GMP (!= ). Currently both options lead to build failures in GnuTLS: https://lists.gnutls.org/pipermail/gnutls-help/2021-February/004680.html (Package definitions attached for posterity.) Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/gnu/packages/nettle.scm b/gnu/packages/nettle.scm index f5e7188ff0..875a858946 100644 --- a/gnu/packages/nettle.scm +++ b/gnu/packages/nettle.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2012, 2013, 2014, 2015 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2012, 2013, 2014, 2015, 2021 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2016 Mark H Weaver ;;; Copyright =C2=A9 2017 Efraim Flashner ;;; @@ -89,3 +89,12 @@ themselves.") ;; Build "fat" binaries where the right implementation is chosen ;; at run time based on CPU features (starting from 3.1.) `(cons "--enable-fat" ,flags)))))) + +(define-public nettle/mini-gmp + (package/inherit nettle + (name "nettle-mini-gmp") + (arguments + (substitute-keyword-arguments (package-arguments nettle) + ((#:configure-flags flags) + `(cons "--enable-mini-gmp" ,flags)))) + (propagated-inputs '()))) diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm index 775e915534..fe2ec88a9e 100644 --- a/gnu/packages/tls.scm +++ b/gnu/packages/tls.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovi= c Court=C3=A8s +;;; Copyright =C2=A9 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 = Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2014, 2015, 2016, 2017, 2018 Mark H Weaver ;;; Copyright =C2=A9 2014 Ian Denhardt ;;; Copyright =C2=A9 2013, 2015 Andreas Enge @@ -165,6 +165,7 @@ living in the same process.") (package (name "gnutls") (version "3.6.15") + (replacement gnutls/mini-nettle) (source (origin (method url-fetch) ;; Note: Releases are no longer on ftp.gnu.org since the @@ -256,6 +257,31 @@ required structures.") (properties '((ftp-server . "ftp.gnutls.org") (ftp-directory . "/gcrypt/gnutls"))))) =20 +;; (define-public gnutls/nettle-mini-gmp +;; (package/inherit gnutls +;; (arguments +;; (substitute-keyword-arguments (package-arguments gnutls) +;; ((#:phases phases '%standard-phases) +;; `(modify-phases ,phases +;; (add-before 'configure 'dont-link-against-libgmp +;; (lambda _ +;; (substitute* "configure" +;; (("GMP_LIBS=3D\"-lgmp\"") +;; "GMP_LIBS=3D\"\"")))))))) +;; (propagated-inputs +;; `(("nettle" ,nettle/mini-gmp) +;; ,@(alist-delete "nettle" (package-propagated-inputs gnutls)))))) + +(define-public gnutls/mini-nettle + (package/inherit gnutls + (arguments + (substitute-keyword-arguments (package-arguments gnutls) + ((#:configure-flags flags ''()) + `(cons "--with-nettle-mini" ,flags)))) + ;; (propagated-inputs + ;; (alist-delete "nettle" (package-propagated-inputs gnutls))) + )) + (define-public gnutls/guile-2.0 ;; GnuTLS for Guile 2.0. (package/inherit gnutls --=-=-=--