From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QLc4Kpw8NmHFpQAAgWs5BA (envelope-from ) for ; Mon, 06 Sep 2021 18:06:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yK+ZJZw8NmFxMAAAbx9fmQ (envelope-from ) for ; Mon, 06 Sep 2021 16:06:52 +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 C20B2128D6 for ; Mon, 6 Sep 2021 18:06:51 +0200 (CEST) Received: from localhost ([::1]:56272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNH90-0005FN-R4 for larch@yhetil.org; Mon, 06 Sep 2021 12:06:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNH3u-0005pj-DA for guix-devel@gnu.org; Mon, 06 Sep 2021 12:01:34 -0400 Received: from mout01.posteo.de ([185.67.36.65]:46531) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNH3q-0001Ut-K7 for guix-devel@gnu.org; Mon, 06 Sep 2021 12:01:34 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 7344324002A for ; Mon, 6 Sep 2021 18:01:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1630944086; bh=5o3PDNngJwO911KLNC/QheqeKOpSGJyfvNw4UYnyEb4=; h=From:To:Subject:Date:From; b=bWrjYC33ERI9/tPVyZZX0AUm/0RExtGYJSGV0tKAnX082LGbkHbW9BEvk4uRmiGwP LRvA8376nzHs7kKK53ZoUKcJnaz6pyNN0rGocglN8eIe2Gt6jQjxGUMu3871Kvy500 n+KArs1teZLFPRX5SCsomQkQMrTpYD7c2/TOmuPMzUoqGH1M1KYHm8RzWnIqZQoqNa +puy2rwfqVICQkOjkARoDjrGGndNUkounu54SYpJXuW3+r4mFDSixiBUaSufXSr8Kj FH9pAM5l7UWu/wFu1lsirGimRLfYD/xQv4Z0GGqWvVX98GnAbkECMEoAtJgsssVVRG 26LCi51TLmeQA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4H3CnK3z1bz6tm5 for ; Mon, 6 Sep 2021 18:01:25 +0200 (CEST) From: Guillaume Le Vaillant To: guix-devel@gnu.org Subject: [core-updates-frozen] Bug in binutils 1.37 Date: Mon, 06 Sep 2021 15:39:52 +0000 Message-ID: <87fsuh4rsb.fsf@kitej> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=185.67.36.65; envelope-from=glv@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630944412; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BMrPb4z89USyvOBduRJyod3aflJM36E65hyiyEaOBC4=; b=aU7MYukK8ew8PqJKHh10u01TgOXRMFrwsoZz4HUlofchmGvew2OW2lfrm8oNq0TxY/uGHc HzedzHud51IwDjVg3uIv/yfCJBxfvOxl2EpDXu2B9stWA6Imc2giiQJKTJNH+1+V0EdwR5 uxwdLtbH1muDFyp2y4fOIqvtcqkP8NTcbKK4LHXthcZ588M5E4JN+1+IpxvGHXeH0f5F1i 8Ks/5ngXdoKGWWFgGS8crRfF7y+n8OXkyWTe9hwfL5PPtDgS/U1rtN97bRISsSc07cZQlx oFODLVWVqNm5LMTtKFViwbunELrSHv4FafYCE30fYvTBy4OCmpjNIATIL2vy9Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630944412; a=rsa-sha256; cv=none; b=AlR0lKpqArfVuWOnHQOdQYAqlOfj0I3clN3JwE+msJ+NP33HNSrJWlt9drMYg/EkxZKpmJ JWVwK3Xv8r+aYAPLJ3VuPsInT8CVfnbwikILGOSENiIXBdgvipMbzWuDcnGqRrsLQrra5f gG8foVZG3k3KE0xTJ8r2WFoSZmnt1lzVOdnLJJVKyjmzkFXc3hbPRxNOkaWxvGE+F5Rd7r 1+jGNpS1ibNG5mRxKXIdSWA+jgwIXLvBGw62tvHZTFzTdEto7Rjl8uJU5RTzLj1pDcOP6u 16HHMguvy8D99ZIkpJ9UDz64aqIj+sFASmUHS9g9MmMJfpfBkqyYyM464FT8rA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=bWrjYC33; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.68 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=bWrjYC33; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: C20B2128D6 X-Spam-Score: -3.68 X-Migadu-Scanner: scn0.migadu.com X-TUID: ETtjI+pJaUKX --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hi, There's a bug in binutils 1.37, which we are using on the core-updates-frozen branch. It's a file descriptor leak that can lead to 'malformed archive' errors when linking libraries. We get this problem at least when building qtwekbit and qtwebengine. A workaround allows us to compile qtwebkit (see [1]), but it doesn't work for qtwebengine. The bug was discussed at [2] and upstream has a patch to fix it at [3]. However, adding this patch to our binutils rebuilds the world. I'm currently trying to build things with the patched binutils. If everything works, should I push this fix on core-updates-frozen, or does someone have an idea that would lead to less rebuilds? P.S.: The patch I'm trying is in attachment. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-gnu-binutils-Fix-file-decriptor-leak.patch Content-Transfer-Encoding: quoted-printable From=20d90e95640f0c2bd3271e370516e51fac56929be7 Mon Sep 17 00:00:00 2001 From: Guillaume Le Vaillant Date: Mon, 6 Sep 2021 17:32:38 +0200 Subject: [PATCH] gnu: binutils: Fix file decriptor leak. * gnu/packages/patches/binutils-1.37-file-descriptor-leak.patch: New file. * gnu/packages/local.mk (dist_patch_DATA): Add it. * gnu/packages/base.scm (binutils)[source]: Use it. =2D-- gnu/local.mk | 1 + gnu/packages/base.scm | 17 +- .../binutils-1.37-file-descriptor-leak.patch | 231 ++++++++++++++++++ 3 files changed, 241 insertions(+), 8 deletions(-) create mode 100644 gnu/packages/patches/binutils-1.37-file-descriptor-leak= .patch diff --git a/gnu/local.mk b/gnu/local.mk index 8c41b5b676..5814587ef2 100644 =2D-- a/gnu/local.mk +++ b/gnu/local.mk @@ -884,6 +884,7 @@ dist_patch_DATA =3D \ %D%/packages/patches/behave-skip-a-couple-of-tests.patch \ %D%/packages/patches/beignet-correct-file-names.patch \ %D%/packages/patches/bidiv-update-fribidi.patch \ + %D%/packages/patches/binutils-1.37-file-descriptor-leak.patch \ %D%/packages/patches/binutils-boot-2.20.1a.patch \ %D%/packages/patches/binutils-loongson-workaround.patch \ %D%/packages/patches/binutils-mingw-w64-timestamp.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index b9841a5cef..f5486c6aae 100644 =2D-- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -510,14 +510,15 @@ change. GNU make offers many powerful extensions ove= r the standard utility.") (package (name "binutils") (version "2.37") =2D (source (origin =2D (method url-fetch) =2D (uri (string-append "mirror://gnu/binutils/binutils-" =2D version ".tar.bz2")) =2D (sha256 =2D (base32 =2D "1m3b2rdfv1dmdpd0bzg1hy7i8a2qng53szc6livyi3nh6101mz37")) =2D (patches (search-patches "binutils-loongson-workaround.patch= ")))) + (source + (origin + (method url-fetch) + (uri (string-append "mirror://gnu/binutils/binutils-" + version ".tar.bz2")) + (sha256 + (base32 "1m3b2rdfv1dmdpd0bzg1hy7i8a2qng53szc6livyi3nh6101mz37")) + (patches (search-patches "binutils-loongson-workaround.patch" + "binutils-1.37-file-descriptor-leak.patch")= ))) (build-system gnu-build-system) =20 ;; TODO: Add dependency on zlib + those for Gold. diff --git a/gnu/packages/patches/binutils-1.37-file-descriptor-leak.patch = b/gnu/packages/patches/binutils-1.37-file-descriptor-leak.patch new file mode 100644 index 0000000000..1fd3d3d9b7 =2D-- /dev/null +++ b/gnu/packages/patches/binutils-1.37-file-descriptor-leak.patch @@ -0,0 +1,231 @@ +From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" +Date: Mon, 26 Jul 2021 05:59:55 -0700 +Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd + +Close the file descriptor if there is no archive plugin file descriptor +to avoid running out of file descriptors on thin archives with many +archive members. + +bfd/ + + PR ld/28138 + * plugin.c (bfd_plugin_close_file_descriptor): Close the file + descriptor there is no archive plugin file descriptor. + +ld/ + + PR ld/28138 + * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for + native build. + + PR ld/28138 + * testsuite/ld-plugin/lto.exp: Run ld/28138 tests. + * testsuite/ld-plugin/pr28138.c: New file. + * testsuite/ld-plugin/pr28138-1.c: Likewise. + * testsuite/ld-plugin/pr28138-2.c: Likewise. + * testsuite/ld-plugin/pr28138-3.c: Likewise. + * testsuite/ld-plugin/pr28138-4.c: Likewise. + * testsuite/ld-plugin/pr28138-5.c: Likewise. + * testsuite/ld-plugin/pr28138-6.c: Likewise. + * testsuite/ld-plugin/pr28138-7.c: Likewise. + +(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742) +(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2) +--- + bfd/plugin.c | 8 +++++++ + ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++ + ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++ + ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++ + 10 files changed, 104 insertions(+) + create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c + create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c + create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c + create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c + create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c + create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c + create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c + create mode 100644 ld/testsuite/ld-plugin/pr28138.c + +diff --git a/bfd/plugin.c b/bfd/plugin.c +index 6cfa2b66470..3bab8febe88 100644 +--- a/bfd/plugin.c ++++ b/bfd/plugin.c +@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd) + && !bfd_is_thin_archive (abfd->my_archive)) + abfd =3D abfd->my_archive; +=20 ++ /* Close the file descriptor if there is no archive plugin file ++ descriptor. */ ++ if (abfd->archive_plugin_fd =3D=3D -1) ++ { ++ close (fd); ++ return; ++ } ++ + abfd->archive_plugin_fd_open_count--; + /* Dup the archive plugin file descriptor for later use, which + will be closed by _bfd_archive_close_and_cleanup. */ +diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.e= xp +index def69e43ab3..999d911ce6a 100644 +--- a/ld/testsuite/ld-plugin/lto.exp ++++ b/ld/testsuite/ld-plugin/lto.exp +@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] = } { + } + } +=20 ++run_cc_link_tests [list \ ++ [list \ ++ "Build pr28138.a" \ ++ "-T" "" \ ++ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \ ++ pr28138-6.c pr28138-7.c} {} "pr28138.a" \ ++ ] \ ++ [list \ ++ "Build pr28138.o" \ ++ "" "" \ ++ {pr28138.c} {} \ ++ ] \ ++] ++ ++set exec_output [run_host_cmd "sh" \ ++ "-c \"ulimit -n 20; \ ++ $CC -Btmpdir/ld -o tmpdir/pr28138 \ ++ tmpdir/pr28138.o tmpdir/pr28138.a\""] ++set exec_output [prune_warnings $exec_output] ++if [string match "" $exec_output] then { ++ if { [isnative] } { ++ set exec_output [run_host_cmd "tmpdir/pr28138" ""] ++ if [string match "PASS" $exec_output] then { ++ pass "PR ld/28138" ++ } else { ++ fail "PR ld/28138" ++ } ++ } else { ++ pass "PR ld/28138" ++ } ++} else { ++ fail "PR ld/28138" ++} ++ + set testname "Build liblto-11.a" + remote_file host delete "tmpdir/liblto-11.a" + set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmp= dir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"] +diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/p= r28138-1.c +new file mode 100644 +index 00000000000..51d119e1642 +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-1.c +@@ -0,0 +1,6 @@ ++extern int a0(void); ++int ++a1(void) ++{ ++ return 1 + a0(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/p= r28138-2.c +new file mode 100644 +index 00000000000..1120cd797e9 +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-2.c +@@ -0,0 +1,6 @@ ++extern int a1(void); ++int ++a2(void) ++{ ++ return 1 + a1(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/p= r28138-3.c +new file mode 100644 +index 00000000000..ec464947ee6 +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-3.c +@@ -0,0 +1,6 @@ ++extern int a2(void); ++int ++a3(void) ++{ ++ return 1 + a2(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/p= r28138-4.c +new file mode 100644 +index 00000000000..475701b2c5c +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-4.c +@@ -0,0 +1,6 @@ ++extern int a3(void); ++int ++a4(void) ++{ ++ return 1 + a3(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/p= r28138-5.c +new file mode 100644 +index 00000000000..e24f86c363e +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-5.c +@@ -0,0 +1,6 @@ ++extern int a4(void); ++int ++a5(void) ++{ ++ return 1 + a4(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/p= r28138-6.c +new file mode 100644 +index 00000000000..b5b938bdb21 +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-6.c +@@ -0,0 +1,6 @@ ++extern int a5(void); ++int ++a6(void) ++{ ++ return 1 + a5(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/p= r28138-7.c +new file mode 100644 +index 00000000000..4ef75bf0f0c +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-7.c +@@ -0,0 +1,6 @@ ++extern int a6(void); ++int ++a7(void) ++{ ++ return 1 + a6(); ++} +diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr2= 8138.c +new file mode 100644 +index 00000000000..68252c9f382 +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138.c +@@ -0,0 +1,20 @@ ++#include ++ ++extern int a7(void); ++ ++int ++a0(void) ++{ ++ return 0; ++} ++ ++int ++main() ++{ ++ if (a7() =3D=3D 7) ++ { ++ printf ("PASS\n"); ++ return 0; ++ } ++ return 1; ++} +--=20 +2.27.0 =2D-=20 2.33.0 --=-=-= Content-Type: text/plain [1] https://issues.guix.gnu.org/50014 [2] https://sourceware.org/bugzilla/show_bug.cgi?id=28138 [3] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c611b40e6bfc8029bff7696814330b5bc0ee5c0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIUEAREKAC0WIQTLxZxm7Ce5cXlAaz5r6CCK3yH+PwUCYTY7VA8cZ2x2QHBvc3Rl by5uZXQACgkQa+ggit8h/j8ldgEAlHc6FhQHLdbLk4TkznoTneZF9UPYV6IO/2CN j5YevosA/0R4SGWehbFLLnaX9lj9Si68+Crzf6OvKtxwzngdnX2A =ikoJ -----END PGP SIGNATURE----- --==-=-=--