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 06DFD45804 for ; Fri, 23 Aug 2024 18:20:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 015B24336D; Fri, 23 Aug 2024 18:20:59 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 480E440295 for ; Fri, 23 Aug 2024 18:20:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c/NEc5CHpUn9o6WKGhQeM8gTyYQ9j9dr70SQyA1p/as=; b=IjDk6UXOvNcMzuaDhjKexJSRsRtIcMjoxPyZkebMSzI5wNVr8IL7ChozQZyMEu1mWnWfDT zuAdCAz9mJ1pC2YgVq9FF1vbrtlhEDlIVnO+3qvu+36PiyWbhoI7IFDwC+b6mNqJwQJZKl r1B8TrM/QR9OV2w+omYPOfD6Y5lwuv0= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-6pc6fABdPSan2l2Y48RdBQ-1; Fri, 23 Aug 2024 12:20:53 -0400 X-MC-Unique: 6pc6fABdPSan2l2Y48RdBQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0A01F1955D48; Fri, 23 Aug 2024 16:20:52 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C1CEB1956053; Fri, 23 Aug 2024 16:20:49 +0000 (UTC) From: Kevin Traynor To: Luca Vizzarro Cc: Paul Szczepanek , Nick Connolly , Maxime Coquelin , dpdk stable Subject: patch 'vhost: fix build with GCC 13' has been queued to stable release 21.11.8 Date: Fri, 23 Aug 2024 17:17:42 +0100 Message-ID: <20240823161929.1004778-34-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/28/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/2f6234f1d916d6244a26249c929b5aee0b136751 Thanks. Kevin --- >From 2f6234f1d916d6244a26249c929b5aee0b136751 Mon Sep 17 00:00:00 2001 From: Luca Vizzarro Date: Wed, 10 Apr 2024 16:21:01 +0100 Subject: [PATCH] vhost: fix build with GCC 13 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 8db1acabeea3fa4b0c673588cfff2b01e0ae9615 ] This patch resolves a build error with GCC 13 and arm/aarch32 as targets: In function ‘mbuf_to_desc’, inlined from ‘vhost_enqueue_async_packed’ at ../lib/vhost/virtio_net.c:1828:6, inlined from ‘virtio_dev_rx_async_packed’ at ../lib/vhost/virtio_net.c:1842:6, inlined from ‘virtio_dev_rx_async_submit_packed’ at ../lib/vhost/virtio_net.c:1900:7: ../lib/vhost/virtio_net.c:1159:18: error: ‘buf_vec[0].buf_addr’ may be used uninitialized [-Werror=maybe-uninitialized] 1159 | buf_addr = buf_vec[vec_idx].buf_addr; | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/vhost/virtio_net.c:1160:18: error: ‘buf_vec[0].buf_iova’ may be used uninitialized [-Werror=maybe-uninitialized] 1160 | buf_iova = buf_vec[vec_idx].buf_iova; | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/vhost/virtio_net.c:1161:35: error: ‘buf_vec[0].buf_len’ may be used uninitialized [-Werror=maybe-uninitialized] 1161 | buf_len = buf_vec[vec_idx].buf_len; | ~~~~~~~~~~~~~~~~^~~~~~~~ GCC complains about the possible runtime path where the while loop which fills buf_vec (in vhost_enqueue_async_packed) is not run. As a consequence it correctly thinks that buf_vec is not initialized while being accessed anyways. This scenario is actually very unlikely as the only way this can occur is if size has overflowed to 0. Meaning that the total packet length would be close to UINT64_MAX (or actually UINT32_MAX). At first glance, the code suggests that this may never happen as the type of size has been changed to 64-bit. For a 32-bit architecture such as arm (e.g. armv7-a) and aarch32, this still happens because the operand types (pkt->pkt_len and sizeof) are 32-bit wide, performing 32-bit arithmetic first (where the overflow can happen) and widening to 64-bit later. The proposed fix simply guarantees to the compiler that the scope which fills buf_vec is accessed at least once, while not disrupting the actual logic. This is based on the assumption that size will always be greater than 0, as suggested by the sizeof, and the packet length will never be as big as UINT32_MAX, and causing an overflow. Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath") Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek Reviewed-by: Nick Connolly Reviewed-by: Maxime Coquelin --- .mailmap | 2 +- lib/vhost/virtio_net.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.mailmap b/.mailmap index ed9ed73919..41d1bdb972 100644 --- a/.mailmap +++ b/.mailmap @@ -985,5 +985,5 @@ Netanel Belgazal Netanel Gonen Niall Power -Nick Connolly +Nick Connolly Nick Nunley Niclas Storm diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index fa0779d03d..9f74a3c997 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -1592,5 +1592,5 @@ vhost_enqueue_async_packed(struct virtio_net *dev, max_tries = 1; - while (size > 0) { + do { /* * if we tried all available ring items, and still @@ -1619,5 +1619,5 @@ vhost_enqueue_async_packed(struct virtio_net *dev, if (avail_idx >= vq->size) avail_idx -= vq->size; - } + } while (size > 0); if (unlikely(mbuf_to_desc(dev, vq, pkt, buf_vec, nr_vec, *nr_buffers, true) < 0)) -- 2.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:10.968779446 +0100 +++ 0034-vhost-fix-build-with-GCC-13.patch 2024-08-23 17:18:09.671429934 +0100 @@ -1 +1 @@ -From 8db1acabeea3fa4b0c673588cfff2b01e0ae9615 Mon Sep 17 00:00:00 2001 +From 2f6234f1d916d6244a26249c929b5aee0b136751 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 8db1acabeea3fa4b0c673588cfff2b01e0ae9615 ] + @@ -55 +56,0 @@ -Cc: stable@dpdk.org @@ -67 +68 @@ -index 111dbb0ac3..ed63605a15 100644 +index ed9ed73919..41d1bdb972 100644 @@ -70 +71,2 @@ -@@ -1031,5 +1031,5 @@ Netanel Gonen +@@ -985,5 +985,5 @@ Netanel Belgazal + Netanel Gonen @@ -72 +73,0 @@ - Nicholas Pratte @@ -78 +79 @@ -index b406b5d7d9..370402d849 100644 +index fa0779d03d..9f74a3c997 100644 @@ -81 +82 @@ -@@ -1936,5 +1936,5 @@ vhost_enqueue_async_packed(struct virtio_net *dev, +@@ -1592,5 +1592,5 @@ vhost_enqueue_async_packed(struct virtio_net *dev, @@ -88 +89 @@ -@@ -1963,5 +1963,5 @@ vhost_enqueue_async_packed(struct virtio_net *dev, +@@ -1619,5 +1619,5 @@ vhost_enqueue_async_packed(struct virtio_net *dev,