From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B6CD045ED8; Wed, 18 Dec 2024 08:34:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 668D24066E; Wed, 18 Dec 2024 08:34:31 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 37290402AE for ; Wed, 18 Dec 2024 08:34:29 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YCljz07NFz2DhqP; Wed, 18 Dec 2024 15:31:51 +0800 (CST) Received: from dggemv703-chm.china.huawei.com (unknown [10.3.19.46]) by mail.maildlp.com (Postfix) with ESMTPS id 8C5C61A016C; Wed, 18 Dec 2024 15:34:25 +0800 (CST) Received: from kwepemn100011.china.huawei.com (7.202.194.114) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 18 Dec 2024 15:34:25 +0800 Received: from kwepemd500024.china.huawei.com (7.221.188.194) by kwepemn100011.china.huawei.com (7.202.194.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 18 Dec 2024 15:34:24 +0800 Received: from kwepemd500024.china.huawei.com ([7.221.188.194]) by kwepemd500024.china.huawei.com ([7.221.188.194]) with mapi id 15.02.1544.011; Wed, 18 Dec 2024 15:34:24 +0800 From: "Wangyunjian(wangyunjian,TongTu)" To: Maxime Coquelin , "dev@dpdk.org" CC: Olivier Matz , Maxime Gouin , "Lilijun (Jerry)" , wangzengyuan , "xiawei (H)" Subject: RE: [PATCH] net/virtio: fix Rx checksum calculation Thread-Topic: [PATCH] net/virtio: fix Rx checksum calculation Thread-Index: AQHbUJkFTgcRUIxx7k2Pw9vmfX+8K7LrnK2w Date: Wed, 18 Dec 2024 07:34:24 +0000 Message-ID: <8fdd9fc017f64ed088932d66119edc38@huawei.com> References: <20241217153253.457646-1-maxime.coquelin@redhat.com> In-Reply-To: <20241217153253.457646-1-maxime.coquelin@redhat.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.242.157] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] > Sent: Tuesday, December 17, 2024 11:33 PM > To: dev@dpdk.org > Cc: Olivier Matz ; Maxime Gouin > ; Maxime Coquelin > > Subject: [PATCH] net/virtio: fix Rx checksum calculation >=20 > From: Olivier Matz >=20 > If hdr->csum_start is larger than packet length, the len argument passed > to rte_raw_cksum_mbuf() overflows and causes a segmentation fault. >=20 > Ignore checksum computation in this case. >=20 > CVE-2024-11614 >=20 > Fixes: ca7036b4af3a ("vhost: fix offload flags in Rx path") >=20 > Signed-off-by: Maxime Gouin > Signed-off-by: Olivier Matz > Reviewed-by: Maxime Coquelin > --- > lib/vhost/virtio_net.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c > index d764d4bc6a..69901ab3b5 100644 > --- a/lib/vhost/virtio_net.c > +++ b/lib/vhost/virtio_net.c > @@ -2823,6 +2823,9 @@ vhost_dequeue_offload(struct virtio_net *dev, > struct virtio_net_hdr *hdr, > */ > uint16_t csum =3D 0, off; >=20 > + if (hdr->csum_start >=3D rte_pktmbuf_pkt_len(m)) > + return; > + The hdr->csum_start does two successive reads from user space to read a variable length data structure. The result overflow if the data structure changes between the two reads. We can prevent double fetch issue by using the temporary variable csum_star= t. Thanks, Yunjian > if (rte_raw_cksum_mbuf(m, hdr->csum_start, > rte_pktmbuf_pkt_len(m) - hdr->csum_start, &csum) < > 0) > return; > -- > 2.47.0