diff options
| author | Léo Le Bouter <lle-bout@zaclys.net> | 2021-02-28 04:40:05 +0100 |
|---|---|---|
| committer | Léo Le Bouter <lle-bout@zaclys.net> | 2021-02-28 04:40:05 +0100 |
| commit | e05c0b334d55d1399303ce097f70eaa2ca3ad7df (patch) | |
| tree | ec3361fbc58cd6db31a8b22575501f6d67247bba /gnu | |
| parent | 8eb9e759dc2aa0aaf150848094211a3efc6abecb (diff) | |
gnu: qemu: Fix CVE-2021-20203.
* gnu/packages/patches/qemu-CVE-2021-20203.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/virtualization.scm (qemu): Apply it.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/local.mk | 1 | ||||
| -rw-r--r-- | gnu/packages/patches/qemu-CVE-2021-20203.patch | 172 | ||||
| -rw-r--r-- | gnu/packages/virtualization.scm | 3 |
3 files changed, 175 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 76bb7ef1f0e..83753e6b4ef 100644 --- a/gnu/local.mk +++ b/gnu/local.mk | |||
| @@ -1561,6 +1561,7 @@ dist_patch_DATA = \ | |||
| 1561 | %D%/packages/patches/python-waitress-fix-tests.patch \ | 1561 | %D%/packages/patches/python-waitress-fix-tests.patch \ |
| 1562 | %D%/packages/patches/pypy3-7.3.1-fix-tests.patch \ | 1562 | %D%/packages/patches/pypy3-7.3.1-fix-tests.patch \ |
| 1563 | %D%/packages/patches/qemu-build-info-manual.patch \ | 1563 | %D%/packages/patches/qemu-build-info-manual.patch \ |
| 1564 | %D%/packages/patches/qemu-CVE-2021-20203.patch \ | ||
| 1564 | %D%/packages/patches/qemu-glibc-2.27.patch \ | 1565 | %D%/packages/patches/qemu-glibc-2.27.patch \ |
| 1565 | %D%/packages/patches/qpdfview-qt515-compat.patch \ | 1566 | %D%/packages/patches/qpdfview-qt515-compat.patch \ |
| 1566 | %D%/packages/patches/qrcodegen-cpp-make-install.patch \ | 1567 | %D%/packages/patches/qrcodegen-cpp-make-install.patch \ |
diff --git a/gnu/packages/patches/qemu-CVE-2021-20203.patch b/gnu/packages/patches/qemu-CVE-2021-20203.patch new file mode 100644 index 00000000000..9d2ceaa649a --- /dev/null +++ b/gnu/packages/patches/qemu-CVE-2021-20203.patch | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | From mboxrd@z Thu Jan 1 00:00:00 1970 | ||
| 2 | Return-Path: <SRS0=i+5i=HB=nongnu.org=qemu-devel-bounces+qemu-devel=archiver.kernel.org@kernel.org> | ||
| 3 | X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on | ||
| 4 | aws-us-west-2-korg-lkml-1.web.codeaurora.org | ||
| 5 | X-Spam-Level: | ||
| 6 | X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_INVALID, | ||
| 7 | DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, | ||
| 8 | MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, | ||
| 9 | URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 | ||
| 10 | Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) | ||
| 11 | by smtp.lore.kernel.org (Postfix) with ESMTP id 87556C433E0 | ||
| 12 | for <qemu-devel@archiver.kernel.org>; Sat, 30 Jan 2021 13:20:40 +0000 (UTC) | ||
| 13 | Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) | ||
| 14 | (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) | ||
| 15 | (No client certificate requested) | ||
| 16 | by mail.kernel.org (Postfix) with ESMTPS id EF26964DE1 | ||
| 17 | for <qemu-devel@archiver.kernel.org>; Sat, 30 Jan 2021 13:20:39 +0000 (UTC) | ||
| 18 | DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF26964DE1 | ||
| 19 | Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com | ||
| 20 | Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org | ||
| 21 | Received: from localhost ([::1]:42488 helo=lists1p.gnu.org) | ||
| 22 | by lists.gnu.org with esmtp (Exim 4.90_1) | ||
| 23 | (envelope-from <qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org>) | ||
| 24 | id 1l5qB3-0008CX-02 | ||
| 25 | for qemu-devel@archiver.kernel.org; Sat, 30 Jan 2021 08:20:37 -0500 | ||
| 26 | Received: from eggs.gnu.org ([2001:470:142:3::10]:45174) | ||
| 27 | by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) | ||
| 28 | (Exim 4.90_1) (envelope-from <ppandit@redhat.com>) | ||
| 29 | id 1l5q9q-0007ld-1c | ||
| 30 | for qemu-devel@nongnu.org; Sat, 30 Jan 2021 08:19:22 -0500 | ||
| 31 | Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42898) | ||
| 32 | by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) | ||
| 33 | (Exim 4.90_1) (envelope-from <ppandit@redhat.com>) | ||
| 34 | id 1l5q9k-0007Ia-TV | ||
| 35 | for qemu-devel@nongnu.org; Sat, 30 Jan 2021 08:19:21 -0500 | ||
| 36 | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; | ||
| 37 | s=mimecast20190719; t=1612012753; | ||
| 38 | h=from:from:reply-to:subject:subject:date:date:message-id:message-id: | ||
| 39 | to:to:cc:cc:mime-version:mime-version:content-type:content-type: | ||
| 40 | content-transfer-encoding:content-transfer-encoding; | ||
| 41 | bh=7vu4z8M+bFjhFzEuAYsQG4i3APx7aMqv7tFxRRO5+8Q=; | ||
| 42 | b=egCsTdgVBnRlHnVN84HsSpNOUl/NkqEnGuv9rRdG2AZ1Fee5ZatpJm5zJ7YUW2HvzB4rtO | ||
| 43 | EaDIKaN1wzf/yHf0CsJ60TPGG3DqQSC/EsTSr2l/GNGq4prDYTXVrS3rXFu9ofByUVvzwU | ||
| 44 | q9Iy1X1Bh3S21m7jXY0AYx4Tu9Ikq9w= | ||
| 45 | Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com | ||
| 46 | [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id | ||
| 47 | us-mta-588-1JF7mzMfP1KpRpNKj4cAWQ-1; Sat, 30 Jan 2021 08:19:08 -0500 | ||
| 48 | X-MC-Unique: 1JF7mzMfP1KpRpNKj4cAWQ-1 | ||
| 49 | Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com | ||
| 50 | [10.5.11.22]) | ||
| 51 | (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) | ||
| 52 | (No client certificate requested) | ||
| 53 | by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F0F439380; | ||
| 54 | Sat, 30 Jan 2021 13:19:07 +0000 (UTC) | ||
| 55 | Received: from localhost.localdomain (unknown [10.33.36.2]) | ||
| 56 | by smtp.corp.redhat.com (Postfix) with ESMTPS id 17D581002C11; | ||
| 57 | Sat, 30 Jan 2021 13:19:04 +0000 (UTC) | ||
| 58 | From: P J P <ppandit@redhat.com> | ||
| 59 | To: Dmitry Fleytman <dmitry.fleytman@gmail.com> | ||
| 60 | Subject: [PATCH] net: vmxnet3: validate configuration values during activate | ||
| 61 | (CVE-2021-20203) | ||
| 62 | Date: Sat, 30 Jan 2021 18:46:52 +0530 | ||
| 63 | Message-Id: <20210130131652.954143-1-ppandit@redhat.com> | ||
| 64 | MIME-Version: 1.0 | ||
| 65 | X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 | ||
| 66 | Authentication-Results: relay.mimecast.com; | ||
| 67 | auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com | ||
| 68 | X-Mimecast-Spam-Score: 0 | ||
| 69 | X-Mimecast-Originator: redhat.com | ||
| 70 | Content-Transfer-Encoding: 8bit | ||
| 71 | Content-Type: text/plain; charset="US-ASCII" | ||
| 72 | Received-SPF: pass client-ip=63.128.21.124; envelope-from=ppandit@redhat.com; | ||
| 73 | helo=us-smtp-delivery-124.mimecast.com | ||
| 74 | X-Spam_score_int: -30 | ||
| 75 | X-Spam_score: -3.1 | ||
| 76 | X-Spam_bar: --- | ||
| 77 | X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.255, | ||
| 78 | DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, | ||
| 79 | RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, | ||
| 80 | SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no | ||
| 81 | X-Spam_action: no action | ||
| 82 | X-BeenThere: qemu-devel@nongnu.org | ||
| 83 | X-Mailman-Version: 2.1.23 | ||
| 84 | Precedence: list | ||
| 85 | List-Id: <qemu-devel.nongnu.org> | ||
| 86 | List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, | ||
| 87 | <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> | ||
| 88 | List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> | ||
| 89 | List-Post: <mailto:qemu-devel@nongnu.org> | ||
| 90 | List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> | ||
| 91 | List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, | ||
| 92 | <mailto:qemu-devel-request@nongnu.org?subject=subscribe> | ||
| 93 | Cc: Gaoning Pan <pgn@zju.edu.cn>, QEMU Developers <qemu-devel@nongnu.org>, | ||
| 94 | Prasad J Pandit <pjp@fedoraproject.org> | ||
| 95 | Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org | ||
| 96 | Sender: "Qemu-devel" | ||
| 97 | <qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org> | ||
| 98 | Archived-At: <https://lore.kernel.org/qemu-devel/20210130131652.954143-1-ppandit@redhat.com/> | ||
| 99 | List-Archive: <https://lore.kernel.org/qemu-devel/> | ||
| 100 | |||
| 101 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
| 102 | |||
| 103 | While activating device in vmxnet3_acticate_device(), it does not | ||
| 104 | validate guest supplied configuration values against predefined | ||
| 105 | minimum - maximum limits. This may lead to integer overflow or | ||
| 106 | OOB access issues. Add checks to avoid it. | ||
| 107 | |||
| 108 | Fixes: CVE-2021-20203 | ||
| 109 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913873 | ||
| 110 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
| 111 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
| 112 | --- | ||
| 113 | hw/net/vmxnet3.c | 13 +++++++++++++ | ||
| 114 | 1 file changed, 13 insertions(+) | ||
| 115 | |||
| 116 | diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c | ||
| 117 | index eff299f629..4a910ca971 100644 | ||
| 118 | --- a/hw/net/vmxnet3.c | ||
| 119 | +++ b/hw/net/vmxnet3.c | ||
| 120 | @@ -1420,6 +1420,7 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
| 121 | vmxnet3_setup_rx_filtering(s); | ||
| 122 | /* Cache fields from shared memory */ | ||
| 123 | s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu); | ||
| 124 | + assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU); | ||
| 125 | VMW_CFPRN("MTU is %u", s->mtu); | ||
| 126 | |||
| 127 | s->max_rx_frags = | ||
| 128 | @@ -1473,6 +1474,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
| 129 | /* Read rings memory locations for TX queues */ | ||
| 130 | pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA); | ||
| 131 | size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize); | ||
| 132 | + if (size > VMXNET3_TX_RING_MAX_SIZE) { | ||
| 133 | + size = VMXNET3_TX_RING_MAX_SIZE; | ||
| 134 | + } | ||
| 135 | |||
| 136 | vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size, | ||
| 137 | sizeof(struct Vmxnet3_TxDesc), false); | ||
| 138 | @@ -1483,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
| 139 | /* TXC ring */ | ||
| 140 | pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA); | ||
| 141 | size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize); | ||
| 142 | + if (size > VMXNET3_TC_RING_MAX_SIZE) { | ||
| 143 | + size = VMXNET3_TC_RING_MAX_SIZE; | ||
| 144 | + } | ||
| 145 | vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size, | ||
| 146 | sizeof(struct Vmxnet3_TxCompDesc), true); | ||
| 147 | VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring); | ||
| 148 | @@ -1524,6 +1531,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
| 149 | /* RX rings */ | ||
| 150 | pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]); | ||
| 151 | size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]); | ||
| 152 | + if (size > VMXNET3_RX_RING_MAX_SIZE) { | ||
| 153 | + size = VMXNET3_RX_RING_MAX_SIZE; | ||
| 154 | + } | ||
| 155 | vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size, | ||
| 156 | sizeof(struct Vmxnet3_RxDesc), false); | ||
| 157 | VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d", | ||
| 158 | @@ -1533,6 +1543,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
| 159 | /* RXC ring */ | ||
| 160 | pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA); | ||
| 161 | size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize); | ||
| 162 | + if (size > VMXNET3_RC_RING_MAX_SIZE) { | ||
| 163 | + size = VMXNET3_RC_RING_MAX_SIZE; | ||
| 164 | + } | ||
| 165 | vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size, | ||
| 166 | sizeof(struct Vmxnet3_RxCompDesc), true); | ||
| 167 | VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size); | ||
| 168 | -- | ||
| 169 | 2.29.2 | ||
| 170 | |||
| 171 | |||
| 172 | |||
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 8da57cf6ab2..1f8c3beea00 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm | |||
| @@ -141,7 +141,8 @@ | |||
| 141 | (sha256 | 141 | (sha256 |
| 142 | (base32 | 142 | (base32 |
| 143 | "1rd41wwlvp0vpialjp2czs6i3lsc338xc72l3zkbb7ixjfslw5y9")) | 143 | "1rd41wwlvp0vpialjp2czs6i3lsc338xc72l3zkbb7ixjfslw5y9")) |
| 144 | (patches (search-patches "qemu-build-info-manual.patch")) | 144 | (patches (search-patches "qemu-build-info-manual.patch" |
| 145 | "qemu-CVE-2021-20203.patch")) | ||
| 145 | (modules '((guix build utils))) | 146 | (modules '((guix build utils))) |
| 146 | (snippet | 147 | (snippet |
| 147 | '(begin | 148 | '(begin |
