Bug 1341531

Summary: qemu gets SIGSEGV when hot-plug a scsi hostdev device with duplicate target address
Product: Red Hat Enterprise Linux 7 Reporter: Han Han <hhan>
Component: qemu-kvm-rhevAssignee: Fam Zheng <famz>
Status: CLOSED ERRATA QA Contact: FuXiangChun <xfu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: dyuan, hhan, juzhang, knoel, pingl, pzhang, rjones, virt-maint, xuzhang, yanyang, yisun, yuhuang
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.6.0-12.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-07 21:13:37 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:
Attachments:
Description Flags
all thread backtrace none

Description Han Han 2016-06-01 09:10:37 UTC
Created attachment 1163556 [details]
all thread backtrace

Description of problem:
as subject
Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.6.0-4.el7.x86_64
libvirt-1.3.4-1.el7.x86_64
kernel-3.10.0-418.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
I prepare a VM named 18550, two scsi disk sdb/sdc
# virsh list 
 Id    Name                           State
----------------------------------------------------
 11    18550          
# lsscsi
[1:0:0:0]    disk    ATA      WDC WD5000AAKS-7 1D05  /dev/sda 
[6:0:0:0]    storage IET      Controller       0001  -        
[6:0:0:1]    disk    IET      VIRTUAL-DISK     0001  /dev/sdb 
[7:0:0:0]    disk    Kingston DT Ultimate G2   PMAP  /dev/sdc 
 
Attach two hostdev scsi disk with the same target address:
# cat hostdev1.xml    
<hostdev mode='subsystem' type='scsi' managed='no'>
<source>
<adapter name='scsi_host7'/>
<address bus='0' target='0' unit='0'/>
</source>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>
# cat hostdev2.xml
<hostdev mode='subsystem' type='scsi' managed='no'>
<source>
<adapter name='scsi_host6'/>
<address bus='0' target='0' unit='1'/>
</source>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>
# virsh attach-device 18550 hostdev1.xml
Device attached successfully
# virsh attach-device 18550 hostdev2.xml
error: Failed to attach device from hostdev2.xml
error: internal error: unable to execute QEMU command 'device_add': lun already used by 'hostdev0'

And I found the SIGSEGV of qemu:
# abrt-cli ls
id a26d4863a43c3df243f6f38c258c2bf0d4f6232c
reason:         qemu-kvm killed by SIGSEGV
time:           Wed 01 Jun 2016 03:51:17 PM CST
cmdline:        /usr/libexec/qemu-kvm -name 18550,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-11-18550/master-key.aes -machine pc-i440fx-rhel7.2.0,accel=kvm,usb=off,vmport=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 1d2cd91c-7848-40cf-91f3-a7de96afca78 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-11-18550/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x6.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x6.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x6.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x9 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/libvirt/images/18550.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=27,id=hostnet0,vhost=on,vhostfd=29 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:b7:63:72,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-11-18550/org.qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -chardev spicevmc,id=charchannel1,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 -device usb-tablet,id=input0 -spice port=5900,addr=0.0.0.0,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -msg timestamp=on
package:        qemu-kvm-rhev-2.6.0-4.el7
uid:            107 (qemu)
Directory:      /var/spool/abrt/ccpp-2016-06-01-03:51:17-10590
Run 'abrt-cli report /var/spool/abrt/ccpp-2016-06-01-03:51:17-10590' for creating a case in Red Hat Customer Portal

Actual results:
SIGSEGV

Expected results:
no SIGSEGV

Additional info:

Comment 2 Han Han 2016-06-02 01:37:36 UTC
Since the bug not reproduced on qemu-kvm-rhev-2.3.0-31.el7_2.14.x86_64. Marked as regression.

Comment 4 Fam Zheng 2016-06-27 05:12:52 UTC
I cannot reproduce this on my machine, the error message is printed by QEMU but there is no crash. Could you provide a backtrace and/or a reproducing environment for me to access?

Comment 5 Han Han 2016-06-28 08:25:27 UTC
Well, the backtrace is in my attachment of comment0. I will give you my environment later. I can reproduce it on qemu-kvm-rhev-2.6.0-9.el7.x86_64

Comment 7 Yang Yang 2016-07-01 03:36:42 UTC
*** Bug 1351444 has been marked as a duplicate of this bug. ***

Comment 8 Miroslav Rezanina 2016-07-08 08:39:38 UTC
Fix included in qemu-kvm-rhev-2.6.0-12.el7

Comment 10 Markus Armbruster 2016-07-22 05:47:44 UTC
*** Bug 1318181 has been marked as a duplicate of this bug. ***

Comment 11 Markus Armbruster 2016-07-25 06:05:46 UTC
*** Bug 1335480 has been marked as a duplicate of this bug. ***

Comment 12 Markus Armbruster 2016-08-02 09:09:31 UTC
*** Bug 1328020 has been marked as a duplicate of this bug. ***

Comment 13 Andrew Jones 2016-08-02 13:48:19 UTC
*** Bug 1350889 has been marked as a duplicate of this bug. ***

Comment 14 Yumei Huang 2016-09-10 15:29:29 UTC
Reproduce:
qemu-kvm-rhev-2.6.0-2.el7
kernel-3.10.0-497.el7.x86_64
libvirt-2.0.0-6.el7.x86_64

With same steps as commet 0, attaching the second hostdev scsi disk fails, and qemu quits.

So the bug is reproduced.

Verify:
qemu-kvm-rhev-2.6.0-23.el7
kernel-3.10.0-497.el7.x86_64
libvirt-2.0.0-6.el7.x86_64

With same steps as comment 0, attaching the second hostdev scsi disk fails, and guest works well.  

So the bug is fixed.

Comment 16 errata-xmlrpc 2016-11-07 21:13:37 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-2016-2673.html