From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BDB0E138350 for ; Fri, 1 May 2020 21:44:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0F82DE08F0; Fri, 1 May 2020 21:44:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D7FBEE08F0 for ; Fri, 1 May 2020 21:44:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8D7FA34EEAF for ; Fri, 1 May 2020 21:44:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 152B71FB for ; Fri, 1 May 2020 21:44:05 +0000 (UTC) From: "Sergei Trofimovich" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sergei Trofimovich" Message-ID: <1588369438.de6868dc18e5f0a9471d357ab9906eef83a3149e.slyfox@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/, sys-devel/binutils/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-devel/binutils/binutils-2.34.ebuild sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch X-VCS-Directories: sys-devel/binutils/ sys-devel/binutils/files/ X-VCS-Committer: slyfox X-VCS-Committer-Name: Sergei Trofimovich X-VCS-Revision: de6868dc18e5f0a9471d357ab9906eef83a3149e X-VCS-Branch: master Date: Fri, 1 May 2020 21:44:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d653b11c-c15d-4d71-85bc-22a070b2276f X-Archives-Hash: 14462ebe908b5604c31b99bfc5b4bdc7 commit: de6868dc18e5f0a9471d357ab9906eef83a3149e Author: Sergei Trofimovich gentoo org> AuthorDate: Fri May 1 21:43:42 2020 +0000 Commit: Sergei Trofimovich gentoo org> CommitDate: Fri May 1 21:43:58 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de6868dc sys-devel/binutils: fix RISC-V ld crash, bug #720280 It's a direct backport of upstream's a2714d6cca1f1c7 ("PR25900, RISC-V: null pointer dereference") Reported-by: David Michael Closes: https://bugs.gentoo.org/720280 Bug: https://sourceware.org/PR25900 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich gentoo.org> sys-devel/binutils/binutils-2.34.ebuild | 1 + .../binutils/files/binutils-2.34-riscv-SEGV.patch | 40 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/sys-devel/binutils/binutils-2.34.ebuild b/sys-devel/binutils/binutils-2.34.ebuild index 805c709df2a..40a250edf7b 100644 --- a/sys-devel/binutils/binutils-2.34.ebuild +++ b/sys-devel/binutils/binutils-2.34.ebuild @@ -86,6 +86,7 @@ RESTRICT="!test? ( test )" PATCHES=( "${FILESDIR}"/${PN}-2.33-gcc-10.patch + "${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch ) MY_BUILDDIR=${WORKDIR}/build diff --git a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch new file mode 100644 index 00000000000..ac70e504918 --- /dev/null +++ b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch @@ -0,0 +1,40 @@ +https://sourceware.org/PR25900 +https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 + +From a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Fri, 1 May 2020 15:32:00 +0930 +Subject: [PATCH] PR25900, RISC-V: null pointer dereference + + PR 25900 + * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before + accessing root.u.def of symbols. Also check root.u.def.section + is non-NULL. Reverse tests so as to make the logic positive. + +--- a/bfd/elfnn-riscv.c ++++ b/bfd/elfnn-riscv.c +@@ -4161,15 +4161,16 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec, + symval = 0; + sym_sec = bfd_und_section_ptr; + } +- else if (h->root.u.def.section->output_section == NULL +- || (h->root.type != bfd_link_hash_defined +- && h->root.type != bfd_link_hash_defweak)) +- continue; +- else ++ else if ((h->root.type == bfd_link_hash_defined ++ || h->root.type == bfd_link_hash_defweak) ++ && h->root.u.def.section != NULL ++ && h->root.u.def.section->output_section != NULL) + { + symval = h->root.u.def.value; + sym_sec = h->root.u.def.section; + } ++ else ++ continue; + + if (h->type != STT_FUNC) + reserve_size = +-- +2.18.2 +