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 47EC0A0093 for ; Wed, 9 Mar 2022 12:02:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C0CB40150; Wed, 9 Mar 2022 12:02:25 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 94B1040150 for ; Wed, 9 Mar 2022 12:02:24 +0100 (CET) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id D4A213F1AF for ; Wed, 9 Mar 2022 11:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646823743; bh=9vTO4q5PWE1C06zudpUI0Gi3b418RfJ1Wtz/Ljn8s/w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S/ulZAGDmo7/pbWZgVobNJIKq1o+AaSrRF3WzcL8kRfr46GCZmjGz1OlppqK2X4Yt IgL17iGTNgCwhH36NvrHJ3JBwe+tghkpOVM7jGlK4XNk6S4OOd6KdNlYaKLHUe1X6m flxWVqHTxCH1I9EG3eLoLimycBMxEohtlduxVrG2xJuoUB0nNy11KUSxgBuWy7KwTT mqMs7QwBwhpfXEkW4vYOjh0XrhS4khGiWVMzfzApRmNmXh2wugBeopfkjLAQoe9Sm5 s4xPLJgKI8Cva04yFnPNt6yC1AZTyjitQbJcsoWuZhj0BlN8xnYNTRG0EDWytGM7I5 OKByBPUMCG5xw== Received: by mail-wm1-f69.google.com with SMTP id r133-20020a1c448b000000b00385c3f3defaso662375wma.3 for ; Wed, 09 Mar 2022 03:02:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9vTO4q5PWE1C06zudpUI0Gi3b418RfJ1Wtz/Ljn8s/w=; b=U64E1FyRBRuJkMuTvnTqE64+Ow6h7lLrIcmDisn0uufD6jKrMsHFG/w+aRNBXiomyD cotFN8/Zot8GlVkc9Z9X/9Ow97Tyh7ooZG0SowhehVwtsurkx0j2OaRCPS2vA0bjhkvy rp1rINiTSNacFdM7YCGwK/2SG9AYM1dAdbRsQSH1WO7SB+CMGT0DoWlnBN3QZM/GQdQ4 6Md6On2C/jIJIeoyOi9i0+VmD7pb//PEtA9jj3dy6Y6cbUeoWODb0+buLbo/FDR4xF61 ur8spk+as+tYufu2nKpIz8QneFZ0qYQOTYB/4sJgX3GzBPt8828bt3oprZtCoOKdevTx YEFg== X-Gm-Message-State: AOAM533kcgPEb/VmpnZx7T1pFK7V9jnnAAO+SDf7pTb1aJvoKYZ6yeuU o2Vc7UOViVNxeD8E8MTtczc65zu7onont9SSOTliEhMa3lnf0QahX4KrfhFRkUsI/abnUD+7v6S NgughXhFHJ9w6yU4g/5wnw89A X-Received: by 2002:a05:600c:3487:b0:382:aa28:fe1f with SMTP id a7-20020a05600c348700b00382aa28fe1fmr2792806wmq.170.1646823743489; Wed, 09 Mar 2022 03:02:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJym/UyVSvyoomJWBCHRkC8Ij8FynS9S4Hm0Xjv9INhYd6mAuWlB3rYiavWRSFfInbE175ikWw== X-Received: by 2002:a05:600c:3487:b0:382:aa28:fe1f with SMTP id a7-20020a05600c348700b00382aa28fe1fmr2792779wmq.170.1646823743245; Wed, 09 Mar 2022 03:02:23 -0800 (PST) Received: from localhost.localdomain (068-133-067-156.ip-addr.inexio.net. [156.67.133.68]) by smtp.gmail.com with ESMTPSA id bg42-20020a05600c3caa00b00380deeaae72sm4955385wmb.1.2022.03.09.03.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 03:02:22 -0800 (PST) From: christian.ehrhardt@canonical.com To: Maxime Coquelin Cc: Chenbo Xia , David Marchand , dpdk stable Subject: patch 'vhost: fix unsafe vring addresses modifications' has been queued to stable release 19.11.12 Date: Wed, 9 Mar 2022 12:00:47 +0100 Message-Id: <20220309110116.1295395-16-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220309110116.1295395-1-christian.ehrhardt@canonical.com> References: <20220309110116.1295395-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 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 19.11.12 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/11/22. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/1e68fe334ff06ce0da2b13734dd36c78a1f5f65f Thanks. Christian Ehrhardt --- >From 1e68fe334ff06ce0da2b13734dd36c78a1f5f65f Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Thu, 27 Jan 2022 12:09:53 +0100 Subject: [PATCH] vhost: fix unsafe vring addresses modifications [ upstream commit 04c27cb673b983ce2580731c0afc4b0e815fd658 ] This patch adds missing protection around vring_invalidate and translate_ring_addresses calls in vhost_user_iotlb_msg. Fixes: eefac9536a90 ("vhost: postpone device creation until rings are mapped") Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia Reviewed-by: David Marchand --- lib/librte_vhost/vhost_user.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 7c16d2fc12..1ee6050ac0 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -2380,8 +2380,11 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg, vhost_user_iotlb_cache_insert(vq, imsg->iova, vva, len, imsg->perm); - if (is_vring_iotlb(dev, vq, imsg)) + if (is_vring_iotlb(dev, vq, imsg)) { + rte_spinlock_lock(&vq->access_lock); *pdev = dev = translate_ring_addresses(dev, i); + rte_spinlock_unlock(&vq->access_lock); + } } break; case VHOST_IOTLB_INVALIDATE: @@ -2391,8 +2394,11 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg, vhost_user_iotlb_cache_remove(vq, imsg->iova, imsg->size); - if (is_vring_iotlb(dev, vq, imsg)) + if (is_vring_iotlb(dev, vq, imsg)) { + rte_spinlock_lock(&vq->access_lock); vring_invalidate(dev, vq); + rte_spinlock_unlock(&vq->access_lock); + } } break; default: -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-09 11:57:44.208545877 +0100 +++ 0016-vhost-fix-unsafe-vring-addresses-modifications.patch 2022-03-09 11:57:43.356938156 +0100 @@ -1 +1 @@ -From 04c27cb673b983ce2580731c0afc4b0e815fd658 Mon Sep 17 00:00:00 2001 +From 1e68fe334ff06ce0da2b13734dd36c78a1f5f65f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 04c27cb673b983ce2580731c0afc4b0e815fd658 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -16 +17 @@ - lib/vhost/vhost_user.c | 10 ++++++++-- + lib/librte_vhost/vhost_user.c | 10 ++++++++-- @@ -19,6 +20,6 @@ -diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c -index 8ee9c3e2db..723c6890c3 100644 ---- a/lib/vhost/vhost_user.c -+++ b/lib/vhost/vhost_user.c -@@ -2564,8 +2564,11 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, - vhost_user_iotlb_cache_insert(dev, vq, imsg->iova, vva, +diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c +index 7c16d2fc12..1ee6050ac0 100644 +--- a/lib/librte_vhost/vhost_user.c ++++ b/lib/librte_vhost/vhost_user.c +@@ -2380,8 +2380,11 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg, + vhost_user_iotlb_cache_insert(vq, imsg->iova, vva, @@ -36 +37 @@ -@@ -2578,8 +2581,11 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, +@@ -2391,8 +2394,11 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,