Bug 1452106
| Summary: | libvirtd crash sometimes while doing 'virsh qemu-attach' | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yafu <yafu> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | yafu <yafu> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.4 | CC: | dyuan, fjin, lizhu, pkrempa, rbalakri, ruchen, xuzhang, yanqzhan, zpeng |
| Target Milestone: | rc | Keywords: | Regression |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-3.2.0-6.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-02 01:34:35 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: | |||
|
Description
yafu
2017-05-18 11:03:55 UTC
Fixed upstream:
commit 6ff99e95771bb33531ea6733a823bc6a30158256
Author: Peter Krempa <pkrempa>
Date: Thu May 18 13:27:24 2017 +0200
qemu: monitor: Don't bother extracting vCPU halted state in text monitor
The code causes the 'offset' variable to be overwritten (possibly with
NULL if neither of the vCPUs is halted) which causes a crash since the
variable is still used after that part.
Additionally there's a bug, since strstr() would look up the '(halted)'
string in the whole string rather than just the currently processed line
the returned data is completely bogus.
Rather than switching to single line parsing let's remove the code
altogether since it has a commonly used JSON monitor alternative and
the data itself is not very useful to report.
The code was introduced in commit cc5e695bde
Verified pass with libvirt-3.2.0-6.virtcov.el7.x86_64.
Test steps:
1.Check the pid of libvirtd:
#pgrep libvirtd
27092
2.Create 10 guests with qemu-cmd:
#for i in {1..10} ; do /usr/libexec/qemu-kvm -hdb /var/lib/libvirt/images/test$i.img -monitor unix:/tmp/demo$i,server,nowait -name test$i -device qxl-vga & done
VNC server running on ::1:5900
VNC server running on ::1:5901
VNC server running on ::1:5902
VNC server running on ::1:5903
VNC server running on ::1:5904
VNC server running on ::1:5905
VNC server running on ::1:5906
VNC server running on ::1:5907
VNC server running on ::1:5908
VNC server running on ::1:5909
3.Execute 'virsh qemu-attach` parallel:
#for pid in `pgrep qemu-kvm` ; do virsh qemu-attach $pid & done
Domain test8 attached to pid 29275
Domain test2 attached to pid 29269
Domain test1 attached to pid 29268
Domain test4 attached to pid 29271
Domain test5 attached to pid 29272
Domain test7 attached to pid 29274
Domain test9 attached to pid 29276
Domain test3 attached to pid 29270
Domain test6 attached to pid 29273
Domain test10 attached to pid 29277
4.Check the guest with 'virsh list':
#virsh list
# virsh list
Id Name State
----------------------------------------------------
10 test8 running
11 test2 running
12 test1 running
13 test4 running
14 test5 running
15 test7 running
16 test3 running
17 test6 running
18 test9 running
19 test10 running
5.Reattach the qemu proccess have attached:
#virsh qemu-attach 29277
virsh qemu-attach 29277
error: Failed to attach to pid 29277
error: operation failed: domain 'test10' already exists with uuid 1d730a93-ecd4-46d8-aa7c-5f519870c40b
6.Attach a non-existing pid:
# virsh qemu-attach 101010
error: Failed to attach to pid 101010
error: Failed to open file '/proc/101010/cmdline': No such file or directory
7.Attach invalid pid
#virsh qemu-attach 0
error: Failed to attach to pid 0
error: pid_value in virDomainQemuAttach must be greater than zero
8.Attach non qemu process pid:
[root@yafu-laptop scripts]# virsh qemu-attach 1
error: Failed to attach to pid 1
error: internal error: Child process (LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin /usr/lib/systemd/systemd -help) unexpected exit status 1: 2017-05-27 03:23:49.111+0000: 30384: debug : virFileClose:110 : Closed fd 29
2017-05-27 03:23:49.111+0000: 30384: debug : virFileClose:110 : Closed fd 31
2017-05-27 03:23:49.111+0000: 30384: debug : virFileClose:110 : Closed fd 26
2017-05-27 03:23:49.112+0000: 30384: debug : virExec:736 : Setting child uid:gid to 107:107 with caps 0
9.After all the steps, the libvirtd does not crash:
#pgrep libvirtd
27092
According to the test results above, move the bug to verified.
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 |