Bug 1195155
Summary: | libvirtd crashes after chardev hotplug crashes qemu | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Jan Kurik <jkurik> |
Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 7.1 | CC: | dyuan, jdenemar, jherrman, jtomko, lhuang, lmiksik, mzhan, ovasik, pm-eus, rbalakri, sherold, virt-bugs, zhwang, zpeng |
Target Milestone: | rc | Keywords: | Upstream, ZStream |
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | libvirt-1.2.8-16.el7_1.1 | Doc Type: | Bug Fix |
Doc Text: |
When attaching a character device, libvirt did not correctly check the status of the domain after the libvirtd daemon exited the monitor operation. As a consequence, freed data from the domain definition could be accessed even when the domain had terminated unexpectedly, which caused libvirtd to crash as well. Now, libvirtd verifies that the domain is online before accessing its definition, which prevents libvirtd from crashing in the described situation.
|
Story Points: | --- |
Clone Of: | 1186765 | Environment: | |
Last Closed: | 2015-03-05 14:10:05 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: | 1186765 | ||
Bug Blocks: |
Description
Jan Kurik
2015-02-23 09:36:10 UTC
Verify this bug with libvirt-1.2.8-16.el7_1.1 and qemu-kvm-rhev-2.1.2-23.el7.x86_64 (because i noticed there is a really libvirtd crashed after qemu crashed when do hotplug chardev, please see bug 1192775): 1.run libvirtd in valgrind: # valgrind --leak-check=full libvirtd ==30538== Memcheck, a memory error detector ==30538== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==30538== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==30538== Command: libvirtd 2.in another terminal hotplug a virtio console than hotplug a qemu-agent: # cat lxcconsole.xml <console type='pty'> <target type='virtio'/> </console> # cat agent.xml <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/r6.agent'/> <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/> <alias name='channel1'/> <address type='virtio-serial' controller='0' bus='0' port='8'/> </channel> # virsh attach-device test3 lxcconsole.xml Device attached successfully # virsh attach-device test3 agent.xml error: Failed to attach device from agent.xml error: operation failed: domain is no longer running 3. check the first terminal , no invalid read/free/write, and libvirtd still live. ... Domain test3 started Device attached successfully error: Failed to attach device from agent.xml error: Unable to read from monitor: Connection reset by peer Domain test3 started Device attached successfully error: Failed to attach device from agent.xml error: operation failed: domain is no longer running ... 4. use a script do this, after 1 hours, libvirtd still live. Also test this with gdb: 1.# cat lxcconsole.xml <console type='pty'> <target type='virtio' port='1'/> </console> 2. use gdb attach libvirtd set breakpoint at qemuDomainAttachChrDevice 3. # virsh attach-device test3 lxcconsole.xml 4.open another terminal kill qemu (after qemuDomainObjEnterMonitor) # kill -11 4711 5. (gdb) 1532 qemuDomainObjEnterMonitor(driver, vm); (gdb) 1533 if (qemuMonitorAttachCharDev(priv->mon, charAlias, &chr->source) < 0) { (gdb) 1538 if (devstr && qemuMonitorAddDevice(priv->mon, devstr) < 0) { (gdb) n 1540 qemuMonitorDetachCharDev(priv->mon, charAlias); (gdb) n 1541 ignore_value(qemuDomainObjExitMonitor(driver, vm)); (gdb) n 1550 virDomainAuditChardev(vm, NULL, chr, "attach", ret == 0); (gdb) n 1505 virDomainObjPtr vm, (gdb) c Continuing. 6. libvirtd not crashed and output a error in client side. # virsh attach-device test3 lxcconsole.xml error: Failed to attach device from lxcconsole.xml error: operation failed: domain is no longer running 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-2015-0625.html |