From: Liuxiangdong via <qemu-devel@nongnu.org>
To: <huangy81@chinatelecom.cn>
Cc: <armbru@redhat.com>, <dgilbert@redhat.com>, <eblake@redhat.com>,
<jasowang@redhat.com>, <lvivier@redhat.com>, <mst@redhat.com>,
<pbonzini@redhat.com>, <qemu-devel@nongnu.org>,
<raphael.norwitz@nutanix.com>, <sgarzare@redhat.com>,
<thuth@redhat.com>, <tugy@chinatelecom.cn>,
"Fangyi (Eric)" <eric.fangyi@huawei.com>, <yezengruan@huawei.com>,
<liuxiangdong5@huawei.com>
Subject: Re: [PATCH v4 3/3] vhost-user: Fix the virtio features negotiation flaw
Date: Wed, 14 Dec 2022 16:15:28 +0800 [thread overview]
Message-ID: <63998620.1030707@huawei.com> (raw)
In-Reply-To: <3e937591a7c96bfb7bc9ac8da7b1e41ff06d7305.1668702822.git.huangy81@chinatelecom.cn>
QEMU will coredump when vm starts.
Using command line:
./build/qemu-system-x86_64 \
-nodefaults \
-m 4G \
-machine pc-i440fx-4.1 \
-accel kvm \
-cpu host \
-smp 4 \
-device qemu-xhci -device usb-kbd -device usb-tablet \
-drive if=none,id=linux,file=test.img,format=raw \
-device virtio-blk-pci,drive=linux,disable-legacy=on \
-vnc :0 \
-d all \
-D %dlog \
-netdev tap,id=hostnet0,ifname=tap0,vhost=on,script=no,downscript=no \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:6b:0d:a1 \
-device cirrus-vga \
-msg timestamp=on
And then:
qemu-system-x86_64: ../hw/net/vhost_net.c:149:
vhost_net_save_acked_features: Assertion `nc->info->type ==
NET_CLIENT_DRIVER_VHOST_USER' failed.
Aborted (core dumped)
Because it may be a tap or vdpa besides vhost user when function
"get_vhost_net(nc->peer)" returns ture.
From: liuxiangdong <liuxiangdong5@huawei.com>
Date: Mon, 5 Dec 2022 07:11:28 +0800
Subject: [PATCH] vhost_net: keep acked_feature only for
NET_CLIENT_DRIVER_VHOST_USER
Keep acked_features in NetVhostUserState up-to-date by function
vhost_net_save_acked_features
in function virtio_net_set_features. But nc->peer->info->type maybe
NET_CLIENT_DRIVER_TAP or
NET_CLIENT_DRIVER_VHOST_VDPA besides NET_CLIENT_DRIVER_VHOST_USER.
Don't keep acked_features in other type now except
NET_CLIENT_DRIVER_VHOST_USER
Fix: vhost-user: Fix the virtio features negotiation flaw
Signed-off-by: liuxiangdong <liuxiangdong5@huawei.com>
---
hw/net/vhost_net.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index a98575ffbc..bea053a742 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -143,8 +143,9 @@ uint64_t vhost_net_get_acked_features(VHostNetState
*net)
void vhost_net_save_acked_features(NetClientState *nc)
{
- assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
- vhost_user_save_acked_features(nc);
+ if (nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+ vhost_user_save_acked_features(nc);
+ }
}
static int vhost_net_get_fd(NetClientState *backend)
--
Gitee
next prev parent reply other threads:[~2022-12-14 8:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 16:51 [PATCH v4 0/3] Fix the virtio features negotiation flaw huangy81
2022-11-17 16:51 ` [PATCH v4 1/3] vhost-user: Refactor vhost acked features saving huangy81
2022-11-17 16:51 ` [PATCH v4 2/3] vhost-user: Refactor the chr_closed_bh huangy81
2022-11-17 16:51 ` [PATCH v4 3/3] vhost-user: Fix the virtio features negotiation flaw huangy81
2022-12-14 8:15 ` Liuxiangdong via [this message]
2022-12-14 8:23 ` Hyman Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63998620.1030707@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eric.fangyi@huawei.com \
--cc=huangy81@chinatelecom.cn \
--cc=jasowang@redhat.com \
--cc=liuxiangdong5@huawei.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=raphael.norwitz@nutanix.com \
--cc=sgarzare@redhat.com \
--cc=thuth@redhat.com \
--cc=tugy@chinatelecom.cn \
--cc=yezengruan@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).