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 39F5342BE5; Tue, 30 May 2023 14:54:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 204C640A82; Tue, 30 May 2023 14:54:28 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id F2135406BC for ; Tue, 30 May 2023 14:54:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685451266; 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=Y9lNc0NukBqUaF2AnGKjVKNSpBGlzxy+ZAN4uwnAfyE=; b=bbHm0JnO0kboVloSCF5ZaGZuuxSiBM5cXxhEr7JG+dA3wMf1KeM08i3P7K4ALxD36xKgZF N5TyxfkHs8zxt/8AugHqlk8Q1U3JfKYJw/7BsnthIbEgNg+sb4nmm2VP4VwYvQ9D6Lm5q7 47xmlm+/Ig/S4djjn7D5CwXHBP3tQgc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-390-NnSxVRnYPgC68JZBakHewQ-1; Tue, 30 May 2023 08:54:23 -0400 X-MC-Unique: NnSxVRnYPgC68JZBakHewQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC62085A5BD; Tue, 30 May 2023 12:54:22 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF434140E955; Tue, 30 May 2023 12:54:21 +0000 (UTC) Message-ID: Date: Tue, 30 May 2023 14:54:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 3/4] vhost: fix invalid call FD handling To: Eelco Chaudron , chenbo.xia@intel.com, david.marchand@redhat.com Cc: dev@dpdk.org References: <168431450017.558450.16680518469610688737.stgit@ebuild.local> <168431454344.558450.2397970324914136724.stgit@ebuild.local> From: Maxime Coquelin In-Reply-To: <168431454344.558450.2397970324914136724.stgit@ebuild.local> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 5/17/23 11:09, Eelco Chaudron wrote: > 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 > --- > lib/vhost/vhost.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h > index 37609c7c8d..23a4e2b1a7 100644 > --- a/lib/vhost/vhost.h > +++ b/lib/vhost/vhost.h > @@ -903,9 +903,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); > > - 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->flags & VIRTIO_DEV_STATS_ENABLED) > __atomic_fetch_add(&vq->stats.guest_notifications, > @@ -974,7 +974,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); > Reporting Chenbo's R-by, from the VDUSE series RFC: Reviewed-by: Chenbo Xia