Bug 1410200

Summary: qemu gets SIGSEGV when hot-plug a vhostuser network
Product: Red Hat Enterprise Linux 7 Reporter: Marcel Kolaja <mkolaja>
Component: qemu-kvm-rhevAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED ERRATA QA Contact: Pei Zhang <pezhang>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: chayang, chhu, dyuan, fjin, jdenemar, jherrman, jsuchane, juzhang, knoel, lhuang, marcandre.lureau, mrezanin, pezhang, snagar, virt-maint, weliao, xuzhang, yalzhang, zpeng
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.6.0-28.el7_3.3 Doc Type: Bug Fix
Doc Text:
Hot plugging a vhostuser network device to a guest virtual machine caused the QEMU emulator to terminate unexpectedly due to access to an uninitialized chardev structure. The handling of vhostuser was improved not to access this structure if it is not initialized. As a result, the vhostuser network device can be hot plugged successfully.
Story Points: ---
Clone Of: 1394140 Environment:
Last Closed: 2017-01-17 20:11:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1394140    
Bug Blocks:    

Description Marcel Kolaja 2017-01-04 18:29:37 UTC
This bug has been copied from bug #1394140 and has been proposed
to be backported to 7.3 z-stream (EUS).

Comment 3 Miroslav Rezanina 2017-01-04 19:35:41 UTC
Fix included in qemu-kvm-rhev-2.6.0-28.el7_3.3

Comment 5 Pei Zhang 2017-01-09 07:54:00 UTC
==Reproduce==
Versions:
3.10.0-514.6.1.el7.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.2.x86_64

Steps:
1. Boot guest
/usr/libexec/qemu-kvm \
-name guest=7.3 \
-machine pc \
-cpu SandyBridge \
-m 1024 \
-smp 2,sockets=2,cores=1,threads=1 \
-object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=yes,size=1073741824 \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-drive file=/var/lib/libvirt/images/jeos-23-64-dpdk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-monitor stdio \
-qmp tcp:0:5555,server,nowait

2. Do hotplug vhostuser by qmp, qemu core dump.
{"execute":"qmp_capabilities"}
{"return": {}}

{"execute": "chardev-add","arguments": {"id": "charnet2","backend": {"type": "socket","data": {"addr": {"type": "unix","data": {"path": "/var/run/openvswitch/vhost-user1"}},"wait": false,"server": false}}},"id": "libvirt-19"}
{"return": {}, "id": "libvirt-19"

{"execute": "netdev_add","arguments": {"type": "vhost-user","chardev": "charnet2","id": "hostnet2"},"id": "libvirt-20"}
Connection closed by foreign host.

(qemu) Segmentation fault

So this bug has been reproduced.


==Verification==
3.10.0-514.6.1.el7.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.3.x86_64

Steps:
1. Boot guest

2. Do hotplug vhostuser by qmp, success.
{"execute":"qmp_capabilities"}
{"return": {}}

{"execute": "chardev-add","arguments": {"id": "charnet2","backend": {"type": "socket","data": {"addr": {"type": "unix","data": {"path": "/var/run/openvswitch/vhost-user1"}},"wait": false,"server": false}}},"id": "libvirt-19"}
{"return": {}, "id": "libvirt-19"}

{"execute": "netdev_add","arguments": {"type": "vhost-user","chardev": "charnet2","id": "hostnet2"},"id": "libvirt-20"}
{"return": {}, "id": "libvirt-20"}

{"execute": "device_add", "arguments": { "driver": "virtio-net-pci", "netdev": "hostnet2", "id": "net2" } ,"id": "libvirt-21"}
{"return": {}, "id": "libvirt-21"}

In guest, the nic added is show.
# lspci | grep "Virtio network"
00:04.0 Ethernet controller: Red Hat, Inc Virtio network device

3. Do hot-unplug, nic can be removed and guest works well.
{"execute": "device_del", "arguments": { "id": "net2" } ,"id": "libvirt-21"}
{"return": {}, "id": "libvirt-21"}

{"execute": "netdev_del","arguments": {"id": "hostnet2"},"id": "libvirt-20"}
{"return": {}, "id": "libvirt-20"}

{"execute": "chardev-remove","arguments": {"id": "charnet2"},"id": "libvirt-19"}
{"return": {}, "id": "libvirt-19"}

In guest, the nic added is removed.
# lspci | grep "Virtio network"
(No output)

So this bug has been fixed well. Thanks.

Comment 6 Pei Zhang 2017-01-09 07:54:39 UTC
Set this bug "VERIFIED" as Comment 5.

Comment 8 errata-xmlrpc 2017-01-17 20:11:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0115.html