Bug 803591

Summary: virsh segfault when attempting to detach disk from non-existent domain
Product: Red Hat Enterprise Linux 6 Reporter: Huang Wenlong <whuang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, cwei, dyuan, gsun, jyang, laine, mprivozn, mzhan, rwu, veillard, weizhan
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-6.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:50:26 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:

Description Huang Wenlong 2012-03-15 07:28:14 UTC
Description of problem:
virsh will crash and report lots of error  when detach-disk  with wrong arguments


Version-Release number of selected component (if applicable):
libvirt-0.9.10-5.el6.x86_64
qemu-kvm-0.12.1.2-2.241.el6.x86_64



How reproducible:
100%

Steps to Reproduce:

1.  try to detach disk with wrong arguments

[root@intel-w3520-12-1 images]# virsh detach-disk vdb guest
error: failed to get domain 'vdb'
*** glibc detected *** virsh: munmap_chunk(): invalid pointer: 0x00007fff500c1478 ***
======= Backtrace: =========
/lib64/libc.so.6[0x30ca0750c6]
/usr/lib64/libvirt.so.0(virFree+0x29)[0x3af164e659]
virsh[0x41afca]
virsh[0x413ca7]
virsh[0x4242fc]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x30ca01ecdd]
virsh[0x40a309]
======= Memory map: ========
00400000-0044b000 r-xp 00000000 fd:00 1065467                            /usr/bin/virsh
0064a000-00654000 rw-p 0004a000 fd:00 1065467                            /usr/bin/virsh
01a20000-01aab000 rw-p 00000000 00:00 0                                  [heap]
30c9800000-30c9820000 r-xp 00000000 fd:00 2102358                        /lib64/ld-2.12.so
30c9a1f000-30c9a20000 r--p 0001f000 fd:00 2102358                        /lib64/ld-2.12.so
30c9a20000-30c9a21000 rw-p 00020000 fd:00 2102358                        /lib64/ld-2.12.so
30c9a21000-30c9a22000 rw-p 00000000 00:00 0
30c9c00000-30c9c02000 r-xp 00000000 fd:00 2102367
 ...
2.# virsh list
 Id    Name                           State
----------------------------------------------------
 15    r                              running


3.

Actual results:
virsh crash and report lots of error

Expected results:
virsh do not crash and handle the error message

Additional info:
libvirtd   works well

it can not be reproduce on libvirt-0.9.4-23.el6_2.6.x86_64.rpm, so a regression bug.

Comment 2 Osier Yang 2012-03-15 07:34:20 UTC
Fixed in upstream.

commit 68fd6a3b346fa848f1e55bd8179277cddd6904be
Author: Alex Jia <ajia>
Date:   Thu Mar 15 13:57:50 2012 +0800

    virsh: fix invalid free

Comment 7 Laine Stump 2012-03-16 14:24:27 UTC
A backported fix has been posted to rhvirt-patches for inclusion in the RHEL build of libvirt:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-March/msg01462.html

Comment 10 Wayne Sun 2012-03-19 08:44:01 UTC
packages:
libvirt-0.9.10-6.el6.x86_64
qemu-kvm-0.12.1.2-2.247.el6.x86_64

follow the steps in description:
# virsh detach-disk vda guest
error: failed to get domain 'vda'
error: Domain not found: no domain with matching name 'vda'

# virsh detach-disk rhel6u2 vdc
error: No found disk whose source path or target is vdc

The problem is fixed.

Comment 12 errata-xmlrpc 2012-06-20 06:50:26 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.

http://rhn.redhat.com/errata/RHSA-2012-0748.html