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 353C842CBC for ; Thu, 15 Jun 2023 03:35:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3005E40E0F; Thu, 15 Jun 2023 03:35:17 +0200 (CEST) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mails.dpdk.org (Postfix) with ESMTP id 6504B40DDA for ; Thu, 15 Jun 2023 03:35:15 +0200 (CEST) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f8d0d684f3so12465965e9.2 for ; Wed, 14 Jun 2023 18:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686792915; x=1689384915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7UsZupuVXuDLiOPxWaBW9Zavd5p+9sEHukZiMTKqzKA=; b=c4RwMtKoWATJWZlm3lSEdjjemBNF6rrUf212eiUpEe0IkL7dEvawKdPrSxlGfFD+xN 0YCnLZ21wkXS2GbDDEq0ycb30k9fa4FJPlx49QWIyEJHTmxzbo0yyNcOta2MNNGtlMOX Jolzvdx3w64oBxMY7/RSiRt+3yH6u59Fg1TAD7O8iphBI7k2+nk39ltxp2t3DmOb5ItN fl+JrZRXsqCJ/PLLr21X4dZlbuoCe53BR+iNoX0pXw49Ei5Oubvpf3Do2knyA5N95Umo 3hLlfRz3Zbh1/HaYDZgDGwgaeuGbJT8nuoJCca5v/nvImnVOncy0aP5/tM+4DrsTpJe5 x71g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686792915; x=1689384915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7UsZupuVXuDLiOPxWaBW9Zavd5p+9sEHukZiMTKqzKA=; b=eNxLFLk4DlrQifxeHdSUOqkgCuoYo0hUS9fJjr3DBlMm3OSIEo6hKXNrEwpMb0AHR9 /owPwiVKWgAN4fYK1UVrUU2pLxsXt9fwlycScbwOrUDCjohErR4+YTTUpRgBRV8lbkRE 5V9ed8AZCyqpJx7AW9hJUQMxtSRx/0LStrRbVHchh7dKHCt2QLCDZlCLLIuHs4PxyL72 XLzZvrbZAZidJmhJ3ZGTHS7oq/yjAj8LyAU1wjA+FcUx4T9aRdt39u3tqXt27qYDpXUB eTM0Y/XfmmKVv9yE9vkmM8G3AAu/ttRRYrru4rSJvAGgDZehfzKrznDaj4iqwI11ZxhC ytzA== X-Gm-Message-State: AC+VfDy3xveztRf5Z55xAgerHqWUZPDEWu0PUNamAD+ZxOs01pXequWW Kgg8wNGPPHo8z0uftPudIzc= X-Google-Smtp-Source: ACHHUZ7cg+lW1xJ8tSa23g3GhySMb/zgyyFrK82liQXs7y3eTVn+dXvEDPrzSZgzRthxl3kq5oeMRw== X-Received: by 2002:adf:dc42:0:b0:306:28f4:963c with SMTP id m2-20020adfdc42000000b0030628f4963cmr10249279wrj.23.1686792915095; Wed, 14 Jun 2023 18:35:15 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id w11-20020a1cf60b000000b003f7ff6b1201sm18727044wmc.29.2023.06.14.18.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 18:35:14 -0700 (PDT) From: luca.boccassi@gmail.com To: Maxime Coquelin Cc: Eelco Chaudron , Chenbo Xia , dpdk stable Subject: patch 'vhost: fix invalid call FD handling' has been queued to stable release 20.11.9 Date: Thu, 15 Jun 2023 02:32:39 +0100 Message-Id: <20230615013258.1439718-44-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230615013258.1439718-1-luca.boccassi@gmail.com> References: <20230615013258.1439718-1-luca.boccassi@gmail.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 20.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/17/23. 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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/bdc6b54535796759d20b0762b9568483540c212a Thanks. Luca Boccassi --- >From bdc6b54535796759d20b0762b9568483540c212a Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Thu, 1 Jun 2023 09:40:08 +0200 Subject: [PATCH] vhost: fix invalid call FD handling [ upstream commit 0445f81883a3aa727ac7f8531beee2c225d3001a ] This patch fixes cases where IRQ injection is tried while the call FD is not valid, which should not happen. Fixes: b1cce26af1dc ("vhost: add notification for packed ring") Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification suppression") Signed-off-by: Maxime Coquelin Signed-off-by: Eelco Chaudron Reviewed-by: Chenbo Xia --- lib/librte_vhost/vhost.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index e96f2d836a..0f6672af3d 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -764,9 +764,9 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) vhost_used_event(vq), old, new); - if ((vhost_need_event(vhost_used_event(vq), new, old) && - (vq->callfd >= 0)) || - unlikely(!signalled_used_valid)) { + if ((vhost_need_event(vhost_used_event(vq), new, old) || + unlikely(!signalled_used_valid)) && + vq->callfd >= 0) { eventfd_write(vq->callfd, (eventfd_t) 1); if (dev->notify_ops->guest_notified) dev->notify_ops->guest_notified(dev->vid); @@ -829,7 +829,7 @@ vhost_vring_call_packed(struct virtio_net *dev, struct vhost_virtqueue *vq) if (vhost_need_event(off, new, old)) kick = true; kick: - if (kick) { + if (kick && vq->callfd >= 0) { eventfd_write(vq->callfd, (eventfd_t)1); if (dev->notify_ops->guest_notified) dev->notify_ops->guest_notified(dev->vid); -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-15 01:56:36.952971880 +0100 +++ 0044-vhost-fix-invalid-call-FD-handling.patch 2023-06-15 01:56:34.659543314 +0100 @@ -1 +1 @@ -From 0445f81883a3aa727ac7f8531beee2c225d3001a Mon Sep 17 00:00:00 2001 +From bdc6b54535796759d20b0762b9568483540c212a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0445f81883a3aa727ac7f8531beee2c225d3001a ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -17 +18 @@ - lib/vhost/vhost.h | 8 ++++---- + lib/librte_vhost/vhost.h | 8 ++++---- @@ -20,7 +21,7 @@ -diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h -index 8554ab4002..40863f7bfd 100644 ---- a/lib/vhost/vhost.h -+++ b/lib/vhost/vhost.h -@@ -902,9 +902,9 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) - "%s: used_event_idx=%d, old=%d, new=%d\n", - __func__, vhost_used_event(vq), old, new); +diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h +index e96f2d836a..0f6672af3d 100644 +--- a/lib/librte_vhost/vhost.h ++++ b/lib/librte_vhost/vhost.h +@@ -764,9 +764,9 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq) + vhost_used_event(vq), + old, new); @@ -35,3 +36,3 @@ - if (dev->flags & VIRTIO_DEV_STATS_ENABLED) - vq->stats.guest_notifications++; -@@ -971,7 +971,7 @@ vhost_vring_call_packed(struct virtio_net *dev, struct vhost_virtqueue *vq) + if (dev->notify_ops->guest_notified) + dev->notify_ops->guest_notified(dev->vid); +@@ -829,7 +829,7 @@ vhost_vring_call_packed(struct virtio_net *dev, struct vhost_virtqueue *vq) @@ -44,2 +45,2 @@ - if (dev->flags & VIRTIO_DEV_STATS_ENABLED) - vq->stats.guest_notifications++; + if (dev->notify_ops->guest_notified) + dev->notify_ops->guest_notified(dev->vid);