Bug 1387665

Summary: usb-serial hotplug crashes libvirtd
Product: Red Hat Enterprise Linux 7 Reporter: Ján Tomko <jtomko>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Pei Zhang <pzhang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.3CC: chhu, dyuan, jdenemar, jtomko, pzhang, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-2.5.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 17:19:14 UTC Type: Bug
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:    
Bug Blocks: 1401400    

Description Ján Tomko 2016-10-21 13:35:06 UTC
Description of problem:


Version-Release number of selected component (if applicable):
libvirt-2.0.0-10.el7

How reproducible:
100 %

Steps to Reproduce:
1. start a domain
2. restart libvirtd
3. try attaching a usb-serial device:
$ cat dev.xml
<serial type="tcp">
    <source mode="bind" host="127.0.0.1" service="2448"/>
    <protocol type="raw"/>
    <target type='usb-serial' port='0'/>
</serial>
$ virsh attach-device domain dev.xml


Actual results:
Libvirtd crashes.

Expected results:
A device is attached.

Additional info:

Comment 1 Ján Tomko 2016-10-21 14:00:17 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2016-October/msg00974.html

Comment 2 Pei Zhang 2016-10-24 10:30:17 UTC
I can reproduce it.

version :
libvirt-2.0.0-10.el7.x86_64
qemu-kvm-rhev-2.6.0-28.el7.x86_64

steps :
1. define and start a guest 

# virsh list 
 Id    Name                           State
----------------------------------------------------
 11    vm1                            running

2. restart libvirtd
# systemctl restart libvirtd 

3. prepare a usb-serial device 
 
# cat dev.xml 
<serial type="tcp">
    <source mode="bind" host="127.0.0.1" service="2448"/>
    <protocol type="raw"/>
    <target type='usb-serial' port='0'/>
</serial>
 
attach-device to guest, libvirtd crash. 

# virsh attach-device vm1 dev.xml 
error: Disconnected from qemu:///system due to I/O error
error: Failed to attach device from dev.xml
error: End of file while reading data: Input/output error

Comment 5 Ján Tomko 2016-10-27 09:27:18 UTC
Fixed upstream by:
commit 00c5386c8622514553c41041312acf0ea86278d7
Author:     Ján Tomko <jtomko>
CommitDate: 2016-10-27 11:15:33 +0200

    Fix crash on usb-serial hotplug

    For domains with no USB address cache, we should not attempt
    to generate a USB address.

    https://bugzilla.redhat.com/show_bug.cgi?id=1387665

git describe: v2.3.0-218-g00c5386

Comment 7 Pei Zhang 2017-04-26 10:31:20 UTC
Verified versions :

libvirt-3.2.0-3.el7.x86_64
qemu-kvm-rhev-2.9.0-1.el7.x86_64

Steps :

1.Start a guest, then restart libvirtd

# virsh list
 Id    Name                           State
----------------------------------------------------
 9     r74                            running

# systemctl restart libvirtd

2. Prepare a usb-serial device 
# cat tcp-serial.xml 
<serial type='tcp'>
      <source mode='bind' host='127.0.0.1' service='4555' tls='no'/>
      <protocol type='raw'/>
      <target type='usb-serial' port='0'/>
    </serial>

# virsh attach-device r74 tcp-serial.xml
error: Failed to attach device from tcp-serial.xml
error: unsupported configuration: usb-serial is not supported in this QEMU binary

Libvirtd will not crash, move to verified.

Comment 8 errata-xmlrpc 2017-08-01 17:19:14 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://access.redhat.com/errata/RHEA-2017:1846

Comment 9 errata-xmlrpc 2017-08-01 23:59:00 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://access.redhat.com/errata/RHEA-2017:1846