Bug 1144920 - libvirtd crashed after use qemu-monitor-event --regex to a running guest
Summary: libvirtd crashed after use qemu-monitor-event --regex to a running guest
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-22 02:25 UTC by Luyao Huang
Modified: 2015-03-05 07:44 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.8-4.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:44:55 UTC
Target Upstream Version:


Attachments (Terms of Use)
back trace (9.89 KB, text/plain)
2014-09-22 02:25 UTC, Luyao Huang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Luyao Huang 2014-09-22 02:25:43 UTC
Created attachment 939852 [details]
back trace

description of problem:
libvirtd crashed after use qemu-monitor-event --regex to a running guest

Version-Release number of selected component (if applicable):
libvirt-1.2.8-3.el7.x86_64
qemu-kvm-rhev-2.1.0-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a running guest

1.# ps aux|grep libvirtd
root     20077  2.2  0.2 563028 19132 ?        Ssl  18:35   0:00 /usr/sbin/libvirtd
root     20234  0.0  0.0 112640   968 pts/10   S+   18:36   0:00 grep --color=auto libvirtd

2.# virsh qemu-monitor-event r6 --regex
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

3.# ps aux|grep libvirtd
root     20239 22.0  0.2 563028 19508 ?        Ssl  18:36   0:00 /usr/sbin/libvirtd
root     20332  0.0  0.0 112640   972 pts/10   R+   18:36   0:00 grep --color=auto libvirtd




Actual results:
libvirtd crashed after use qemu-monitor-event --regex to a running guest

Expected results:
Don't crash
Additional info:

Comment 1 Ján Tomko 2014-09-22 12:10:32 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2014-September/msg01276.html

Comment 2 Eric Blake 2014-09-22 15:57:50 UTC
Which is smarter, ignoring the flags when 'event' is NULL, or requiring that 'event' be non-NULL when either the regex or nocase is present?

Comment 3 Ján Tomko 2014-09-22 16:26:43 UTC
I think ingoring it would be nicer than throwing an error.

I'm fine with your fix as well, but the error message could be more specific (as NULL argument is allowed without the flags).

Comment 4 Ján Tomko 2014-09-26 11:45:29 UTC
Fixed upstream by:
commit b987c4c3f4829eb8a0134b687cb9748ff724f98a
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2014-09-26 13:35:51 +0200

    Check for NULL in qemu monitor event filter
    
    When virConnectDomainQemuMonitorEventRegister is called with the
    VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX flag,
    ignore the flag instead of crashing.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1144920

git describe: v1.2.9-rc1-16-gb987c4c

Comment 7 vivian zhang 2014-10-08 05:44:23 UTC
I can reproduce with build: libvirt-1.2.8-3.el7.x86_64

verify with build : libvirt-1.2.8-4.el7.x86_64

step:
1: prepare a running guest r6

2: # ps aux |grep libvirtd
root      4177  0.6  0.2 1079420 23192 ?       Ssl  13:15   0:06 /usr/sbin/libvirtd --listen
root      5826  0.0  0.0 112644   984 pts/0    S+   13:33   0:00 grep --color=auto libvirtd


3: run command qemu-monitor-event with --regex, then ctrl+c to quit normally 
# virsh qemu-monitor-event r6 --regex
^Cevent loop interrupted
events received: 0

4. run command qemu-monitor-event with --regex, then destroy guest to trigger events
# virsh qemu-monitor-event r6 --regex
event SHUTDOWN at 1412746683.984157 for domain r6: <null>
events received: 1

5. recheck libvirtd process, no crash happened
# ps aux |grep libvirtd
root      4177  0.6  0.2 1079420 23356 ?       Ssl  13:15   0:09 /usr/sbin/libvirtd --listen
root      6685  0.0  0.0 112644   984 pts/0    S+   13:39   0:00 grep --color=auto libvirtd


move to verified.

Comment 9 errata-xmlrpc 2015-03-05 07:44:55 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/RHSA-2015-0323.html


Note You need to log in before you can comment on or make changes to this bug.