From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cFzGJuoOxmFjVAAAgWs5BA (envelope-from ) for ; Fri, 24 Dec 2021 19:18:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mCVwIuoOxmFQdgAAB5/wlQ (envelope-from ) for ; Fri, 24 Dec 2021 18:18:18 +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 D2BB62894E for ; Fri, 24 Dec 2021 19:18:16 +0100 (CET) Received: from localhost ([::1]:55860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0p8y-0003dC-2X for larch@yhetil.org; Fri, 24 Dec 2021 13:18:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0p8k-0003cm-9c for guix-patches@gnu.org; Fri, 24 Dec 2021 13:18:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0p8k-0005x2-0q for guix-patches@gnu.org; Fri, 24 Dec 2021 13:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n0p8j-0005MW-TX for guix-patches@gnu.org; Fri, 24 Dec 2021 13:18:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52783] [PATCH] gnu: binutils: Fix CVE-2021-45078. Resent-From: Leo Famulari Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Dec 2021 18:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52783 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52783@debbugs.gnu.org Cc: maxim.cournoyer@gmail.com X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164036983920535 (code B ref -1); Fri, 24 Dec 2021 18:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Dec 2021 18:17:19 +0000 Received: from localhost ([127.0.0.1]:38045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n0p7z-0005L4-93 for submit@debbugs.gnu.org; Fri, 24 Dec 2021 13:17:19 -0500 Received: from lists.gnu.org ([209.51.188.17]:57040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n0p7w-0005Kw-Qy for submit@debbugs.gnu.org; Fri, 24 Dec 2021 13:17:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0p7s-0003HE-Nx for guix-patches@gnu.org; Fri, 24 Dec 2021 13:17:12 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:38281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0p7m-0005s8-KS for guix-patches@gnu.org; Fri, 24 Dec 2021 13:17:04 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 0D4583200B8B; Fri, 24 Dec 2021 13:16:58 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 24 Dec 2021 13:16:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=mesmtp; bh=Zs4z8bcytzk816Oa6ujXpn5 2fIXT66j4fBAWIOO/Ip0=; b=HXRRQRl4jHa6AZCQiFJzrOnW5ifvo9lrGO1/vkb kJOa9rEjvUQlI+LlAQS8ubH14wRnX5qVP/8PMvZJQq4a4ReKcIBKqF7okx5fAXUy L7mS5NVFGNzf84S5ecphJuFk2MG1U8nhpPlL1FZGr2kY191R68ej6Q0ziqjnfLN9 CfoQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Zs4z8bcytzk816Oa6 ujXpn52fIXT66j4fBAWIOO/Ip0=; b=Yr5b740L9lpfYi0K0qvKf7XJ//OaKB9E+ gL6qu3HkmEkKc33XGe44CDOrGUVp5aF1J48DifXOL6jkFBduZFshke9hJ+jyeszd PtlI/UwYXNrend0W2RcOD3oNrpax4pbU8H656YqZebFi6GBypKTXatDJqeLb8r3U 4TiFnsJCdcQg9yzUbiqgu7W8aDlS74OFR3Gyl/SdC66MFoqYgcGp92sKLb4VoJT5 3H9WZMYdKkCV+ZIFPU1g3l4o6VnsIgBibdNJ8oCSgwT1Mf2dNrXwrYHV1XwsN4ti iraFTX2VQNeyc+Gm77vbDorBZg4QN3S25JG+lFdAs8wKelZWiWDIw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddruddutddgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpefnvghoucfhrghmuhhlrghrihcuoehlvghosehfrghmuhhlrghr ihdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeekgeehfeefffeiuefhgeelieevveelie duveffteelgefhgeehhfekhedvtdegjeenucffohhmrghinhepmhhithhrvgdrohhrghdp shhouhhrtggvfigrrhgvrdhorhhgpdhtvgigihhnfhhordhnrghmvgenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlvghosehfrghmuhhlrghr ihdrnhgrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Dec 2021 13:16:58 -0500 (EST) From: Leo Famulari Date: Fri, 24 Dec 2021 13:16:54 -0500 Message-Id: <802baa40ed72d1020c15226ec295187bbb1565be.1640369781.git.leo@famulari.name> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=64.147.123.25; envelope-from=leo@famulari.name; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640369897; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Zs4z8bcytzk816Oa6ujXpn52fIXT66j4fBAWIOO/Ip0=; b=oLdnXTIvBpCMekfwOuhfo6e1nQhv8Mi2gOs7s/czlOy+RFQVuqK62rn5Ple5NMRP+221Zo 9/yTk3ykYKtFmrIgiBuLWwvS8qigxahTSq/nHTUEO1z3yvwMYeMyUkC46NW3ODh4o61y1N cxfcHbk7qcrFtZJEoO6L5mO/fThGh1+dm2UHovTdBlTybE9DcnqWyVvO3Q37+qTLfvxHJI e8PEmeBBsupOE3m5st/LOkLtjggNC67eLfNjruN3bBZ3YD0FKro7K8aM4YdJI63l9392bx wX4GWZ+OrgS+cWf+S70n1vx51uFGZj+sw74Xm7+A9UtWIC0nml2kNLxZUTvNuQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640369897; a=rsa-sha256; cv=none; b=rxVPM5ZW67UoxE3PQxXRhhG3Rs67sj8eO1E6tS0ErAXJc3tH+EOISmbfGQ5wkxFpw688Gw xboMzkyJNnS+SnfajpzBOCfgy8OcHJUJ903P/cI539su6UfU81tm7ViEbrtgxaHzySdc0H lYtOADWpQrz52n5IsQEumk5lIutIvFtkAeh51YlnlV6bsgxUB4KPWSccscvR9EeY7O1i88 AVvl/6b4V5At3nKj+vJECAADyRDTmrYWSFeyGC6c7lobW2tBlKeJBJGI43/gFn/7nQNuT2 Jm51q00YhxodibU8AzBSh9G2CVtK/VHYw5haqiQhxkwp77EBWphAPESGg8tnbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=famulari.name header.s=mesmtp header.b=HXRRQRl4; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=Yr5b740L; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.86 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=famulari.name header.s=mesmtp header.b=HXRRQRl4; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=Yr5b740L; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D2BB62894E X-Spam-Score: -0.86 X-Migadu-Scanner: scn0.migadu.com X-TUID: CwSUvU/BeBEn This is for the release branch. Should we also use a graft for the master branch? It would be even better if we could add a binutils-next package that users could install, in my opinion. * gnu/packages/patches/binutils-CVE-2021-45078.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/base.scm (binutils)[source]: Use it. --- gnu/local.mk | 1 + gnu/packages/base.scm | 3 +- .../patches/binutils-CVE-2021-45078.patch | 257 ++++++++++++++++++ 3 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/binutils-CVE-2021-45078.patch diff --git a/gnu/local.mk b/gnu/local.mk index aa0117a3f5..546b940eb6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -906,6 +906,7 @@ dist_patch_DATA = \ %D%/packages/patches/binutils-loongson-workaround.patch \ %D%/packages/patches/binutils-mingw-w64-timestamp.patch \ %D%/packages/patches/binutils-mingw-w64-deterministic.patch \ + %D%/packages/patches/binutils-CVE-2021-45078.patch \ %D%/packages/patches/blender-2.79-gcc8.patch \ %D%/packages/patches/blender-2.79-gcc9.patch \ %D%/packages/patches/blender-2.79-newer-ffmpeg.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 12e4de52d4..be6fbf608d 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -521,7 +521,8 @@ (define-public binutils (sha256 (base32 "1m3b2rdfv1dmdpd0bzg1hy7i8a2qng53szc6livyi3nh6101mz37")) (patches (search-patches "binutils-loongson-workaround.patch" - "binutils-2.37-file-descriptor-leak.patch")))) + "binutils-2.37-file-descriptor-leak.patch" + "binutils-CVE-2021-45078.patch")))) (build-system gnu-build-system) (arguments `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency diff --git a/gnu/packages/patches/binutils-CVE-2021-45078.patch b/gnu/packages/patches/binutils-CVE-2021-45078.patch new file mode 100644 index 0000000000..fca692bdb5 --- /dev/null +++ b/gnu/packages/patches/binutils-CVE-2021-45078.patch @@ -0,0 +1,257 @@ +Fix CVE-2021-45078 (incomplete fix for CVE-2018-12699): + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45078 +https://sourceware.org/bugzilla/show_bug.cgi?id=28694 + +Patch copied from upstream source repository: + +https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=161e87d12167b1e36193385485c1f6ce92f74f02 + +From 161e87d12167b1e36193385485c1f6ce92f74f02 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Wed, 15 Dec 2021 11:48:42 +1030 +Subject: [PATCH] PR28694, Out-of-bounds write in stab_xcoff_builtin_type + + PR 28694 + * stabs.c (stab_xcoff_builtin_type): Make typenum unsigned. + Negate typenum earlier, simplifying bounds checking. Correct + off-by-one indexing. Adjust switch cases. +--- + binutils/stabs.c | 87 ++++++++++++++++++++++++------------------------ + 1 file changed, 43 insertions(+), 44 deletions(-) + +diff --git a/binutils/stabs.c b/binutils/stabs.c +index 274bfb0e7fa..83ee3ea5fa4 100644 +--- a/binutils/stabs.c ++++ b/binutils/stabs.c +@@ -202,7 +202,7 @@ static debug_type stab_find_type (void *, struct stab_handle *, const int *); + static bool stab_record_type + (void *, struct stab_handle *, const int *, debug_type); + static debug_type stab_xcoff_builtin_type +- (void *, struct stab_handle *, int); ++ (void *, struct stab_handle *, unsigned int); + static debug_type stab_find_tagged_type + (void *, struct stab_handle *, const char *, int, enum debug_type_kind); + static debug_type *stab_demangle_argtypes +@@ -3496,166 +3496,167 @@ stab_record_type (void *dhandle ATTRIBUTE_UNUSED, struct stab_handle *info, + + static debug_type + stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info, +- int typenum) ++ unsigned int typenum) + { + debug_type rettype; + const char *name; + +- if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT) ++ typenum = -typenum - 1; ++ if (typenum >= XCOFF_TYPE_COUNT) + { +- fprintf (stderr, _("Unrecognized XCOFF type %d\n"), typenum); ++ fprintf (stderr, _("Unrecognized XCOFF type %d\n"), -typenum - 1); + return DEBUG_TYPE_NULL; + } +- if (info->xcoff_types[-typenum] != NULL) +- return info->xcoff_types[-typenum]; ++ if (info->xcoff_types[typenum] != NULL) ++ return info->xcoff_types[typenum]; + +- switch (-typenum) ++ switch (typenum) + { +- case 1: ++ case 0: + /* The size of this and all the other types are fixed, defined + by the debugging format. */ + name = "int"; + rettype = debug_make_int_type (dhandle, 4, false); + break; +- case 2: ++ case 1: + name = "char"; + rettype = debug_make_int_type (dhandle, 1, false); + break; +- case 3: ++ case 2: + name = "short"; + rettype = debug_make_int_type (dhandle, 2, false); + break; +- case 4: ++ case 3: + name = "long"; + rettype = debug_make_int_type (dhandle, 4, false); + break; +- case 5: ++ case 4: + name = "unsigned char"; + rettype = debug_make_int_type (dhandle, 1, true); + break; +- case 6: ++ case 5: + name = "signed char"; + rettype = debug_make_int_type (dhandle, 1, false); + break; +- case 7: ++ case 6: + name = "unsigned short"; + rettype = debug_make_int_type (dhandle, 2, true); + break; +- case 8: ++ case 7: + name = "unsigned int"; + rettype = debug_make_int_type (dhandle, 4, true); + break; +- case 9: ++ case 8: + name = "unsigned"; + rettype = debug_make_int_type (dhandle, 4, true); + break; +- case 10: ++ case 9: + name = "unsigned long"; + rettype = debug_make_int_type (dhandle, 4, true); + break; +- case 11: ++ case 10: + name = "void"; + rettype = debug_make_void_type (dhandle); + break; +- case 12: ++ case 11: + /* IEEE single precision (32 bit). */ + name = "float"; + rettype = debug_make_float_type (dhandle, 4); + break; +- case 13: ++ case 12: + /* IEEE double precision (64 bit). */ + name = "double"; + rettype = debug_make_float_type (dhandle, 8); + break; +- case 14: ++ case 13: + /* This is an IEEE double on the RS/6000, and different machines + with different sizes for "long double" should use different + negative type numbers. See stabs.texinfo. */ + name = "long double"; + rettype = debug_make_float_type (dhandle, 8); + break; +- case 15: ++ case 14: + name = "integer"; + rettype = debug_make_int_type (dhandle, 4, false); + break; +- case 16: ++ case 15: + name = "boolean"; + rettype = debug_make_bool_type (dhandle, 4); + break; +- case 17: ++ case 16: + name = "short real"; + rettype = debug_make_float_type (dhandle, 4); + break; +- case 18: ++ case 17: + name = "real"; + rettype = debug_make_float_type (dhandle, 8); + break; +- case 19: ++ case 18: + /* FIXME */ + name = "stringptr"; + rettype = NULL; + break; +- case 20: ++ case 19: + /* FIXME */ + name = "character"; + rettype = debug_make_int_type (dhandle, 1, true); + break; +- case 21: ++ case 20: + name = "logical*1"; + rettype = debug_make_bool_type (dhandle, 1); + break; +- case 22: ++ case 21: + name = "logical*2"; + rettype = debug_make_bool_type (dhandle, 2); + break; +- case 23: ++ case 22: + name = "logical*4"; + rettype = debug_make_bool_type (dhandle, 4); + break; +- case 24: ++ case 23: + name = "logical"; + rettype = debug_make_bool_type (dhandle, 4); + break; +- case 25: ++ case 24: + /* Complex type consisting of two IEEE single precision values. */ + name = "complex"; + rettype = debug_make_complex_type (dhandle, 8); + break; +- case 26: ++ case 25: + /* Complex type consisting of two IEEE double precision values. */ + name = "double complex"; + rettype = debug_make_complex_type (dhandle, 16); + break; +- case 27: ++ case 26: + name = "integer*1"; + rettype = debug_make_int_type (dhandle, 1, false); + break; +- case 28: ++ case 27: + name = "integer*2"; + rettype = debug_make_int_type (dhandle, 2, false); + break; +- case 29: ++ case 28: + name = "integer*4"; + rettype = debug_make_int_type (dhandle, 4, false); + break; +- case 30: ++ case 29: + /* FIXME */ + name = "wchar"; + rettype = debug_make_int_type (dhandle, 2, false); + break; +- case 31: ++ case 30: + name = "long long"; + rettype = debug_make_int_type (dhandle, 8, false); + break; +- case 32: ++ case 31: + name = "unsigned long long"; + rettype = debug_make_int_type (dhandle, 8, true); + break; +- case 33: ++ case 32: + name = "logical*8"; + rettype = debug_make_bool_type (dhandle, 8); + break; +- case 34: ++ case 33: + name = "integer*8"; + rettype = debug_make_int_type (dhandle, 8, false); + break; +@@ -3664,9 +3665,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info, + } + + rettype = debug_name_type (dhandle, name, rettype); +- +- info->xcoff_types[-typenum] = rettype; +- ++ info->xcoff_types[typenum] = rettype; + return rettype; + } + +-- +2.27.0 + -- 2.34.0