Bug 1812965 - libvirtd crashed when do "virsh guestinfo vm" if vm's guest agent doesn't support guest-get-fsinfo
Summary: libvirtd crashed when do "virsh guestinfo vm" if vm's guest agent doesn't sup...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 8.0
Assignee: Peter Krempa
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-12 15:24 UTC by Fangge Jin
Modified: 2020-05-12 10:28 UTC (History)
8 users (show)

Fixed In Version: libvirt-6.0.0-11.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-05 09:59:00 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2017 0 None None None 2020-05-05 09:59:43 UTC

Description Fangge Jin 2020-03-12 15:24:14 UTC
Description of problem:
libvirtd crashed when do "virsh guestinfo vm" if vm's guest agent doesn't support guest-get-fsinfo

Version-Release number of selected component (if applicable):
libvirt-6.0.0-10.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Install qemu-ga of old version that doesn't support guest-get-fsinfo in windows guest

2. Do "virsh guestinfo":
#  virsh guestinfo esx6.7-win2019-x86_64
error: Disconnected from qemu:///system due to keepalive timeout
error: internal error: connection closed due to keepalive timeout


3. Check libvirt log:

2020-03-12 15:18:26.645+0000: 3232: debug : qemuAgentCommand:1131 : Send command '{"execute":"guest-get-fsinfo"}' for write, seconds = -2
2020-03-12 15:18:26.646+0000: 3232: debug : qemuAgentCheckError:1069 : unable to execute QEMU agent command {"execute":"guest-get-fsinfo"}: {"error":{"class":"CommandNotFound","desc":"The command guest-get-fsinfo has not been found"}}


Actual results:
libvirtd crashed

Expected results:
libvirtd should not crash

Additional info:
Backtrace:
Thread 2 "libvirtd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f8d2861b700 (LWP 3049)]
0x00007f8cebca38d5 in qemuDomainGetGuestInfo (dom=<optimized out>, types=<optimized out>, params=0x7f8d2861a800, nparams=0x7f8d2861a7fc, 
    flags=<optimized out>) at ../../src/qemu/qemu_driver.c:23194
23194	        qemuAgentFSInfoFree(agentfsinfo[i]);
(gdb) bt
#0  0x00007f8cebca38d5 in qemuDomainGetGuestInfo (dom=<optimized out>, types=<optimized out>, params=0x7f8d2861a800, nparams=0x7f8d2861a7fc, 
    flags=<optimized out>) at ../../src/qemu/qemu_driver.c:23194
#1  0x00007f8d32dfc709 in virDomainGetGuestInfo (domain=domain@entry=0x7f8d20001320, types=0, params=params@entry=0x7f8d2861a800, 
    nparams=nparams@entry=0x7f8d2861a7fc, flags=0) at ../../src/libvirt-domain.c:12343
#2  0x0000560bd51f0586 in remoteDispatchDomainGetGuestInfo (ret=0x7f8d20001060, args=0x7f8d20001030, rerr=0x7f8d2861a8c0, msg=0x560bd573e9a0, 
    client=<optimized out>, server=0x560bd56bbee0) at ../../src/remote/remote_daemon_dispatch.c:7470
#3  remoteDispatchDomainGetGuestInfoHelper (server=0x560bd56bbee0, client=<optimized out>, msg=0x560bd573e9a0, rerr=0x7f8d2861a8c0, 
    args=0x7f8d20001030, ret=0x7f8d20001060) at ./remote/remote_daemon_dispatch_stubs.h:6052
#4  0x00007f8d32cc6cf0 in virNetServerProgramDispatchCall (msg=0x560bd573e9a0, client=0x560bd57493c0, server=0x560bd56bbee0, prog=0x560bd57107c0)
    at ../../src/rpc/virnetserverprogram.c:430
#5  virNetServerProgramDispatch (prog=0x560bd57107c0, server=server@entry=0x560bd56bbee0, client=client@entry=0x560bd57493c0, 
    msg=msg@entry=0x560bd573e9a0) at ../../src/rpc/virnetserverprogram.c:302
#6  0x00007f8d32cce7e7 in virNetServerProcessMsg (srv=srv@entry=0x560bd56bbee0, client=0x560bd57493c0, prog=<optimized out>, msg=0x560bd573e9a0)
    at ../../src/rpc/virnetserver.c:136
#7  0x00007f8d32ccec54 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x560bd56bbee0) at ../../src/rpc/virnetserver.c:153
#8  0x00007f8d32b633c0 in virThreadPoolWorker (opaque=opaque@entry=0x560bd56bb550) at ../../src/util/virthreadpool.c:163
#9  0x00007f8d32b6201e in virThreadHelper (data=<optimized out>) at ../../src/util/virthread.c:196
#10 0x00007f8d2ee162de in start_thread () from /lib64/libpthread.so.0
#11 0x00007f8d2eb47e83 in clone () from /lib64/libc.so.6

Comment 2 Peter Krempa 2020-03-16 21:15:26 UTC
Fixed upstream by:

530ac28861 qemuDomainGetGuestInfo: don't assign NULL hostname
0fdb7385e4 qemuDomainGetGuestInfo: Don't try to free a negative number of entries
da1b193227 qemuAgentFSInfoFormatParams: Remove pointless returned value

Comment 6 Lili Zhu 2020-04-15 08:41:08 UTC
reproduce this bug with:
libvirt-daemon-6.0.0-10.module+el8.2.0+5984+dce93708.x86_64
qemu-kvm-4.2.0-15.module+el8.2.0+6029+618ef2ec.x86_64

1. prepare a windows guest with qemu-ga of old version that doesn't support guest-get-fsinfo 
# virsh domtime win10
Time: 1586896655

2. check libvirtd
# systemctl status libvirtd 
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-04-15 04:38:30 EDT; 1min 6s ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 2328745 (libvirtd)
    Tasks: 19 (limit: 32768)
   Memory: 1.8G
   CGroup: /system.slice/libvirtd.service
           ├─  31947 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           ├─  31948 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           └─2328745 /usr/sbin/libvirtd --timeout 120

3. try to get information about the guest
# virsh guestinfo win10 
error: Disconnected from qemu:///system due to end of file
error: End of file while reading data: Input/output error

4. check libvirtd again
# systemctl status libvirtd 
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-04-15 04:40:05 EDT; 28s ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 2328892 (libvirtd)
    Tasks: 19 (limit: 32768)
   Memory: 1.8G
   CGroup: /system.slice/libvirtd.service
           ├─  31947 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           ├─  31948 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           └─2328892 /usr/sbin/libvirtd --timeout 120

libvirtd crashed

Comment 7 Lili Zhu 2020-04-15 09:02:02 UTC
verify this bug with:
libvirt-daemon-6.0.0-17.module+el8.2.0+6257+0d066c28.x86_64
qemu-kvm-4.2.0-17.module+el8.2.0+6141+0f540f16.x86_64

1. check libvirtd
# systemctl status libvirtd 
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-04-15 04:44:36 EDT; 8s ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 2329357 (libvirtd)
    Tasks: 19 (limit: 32768)
   Memory: 1.8G
   CGroup: /system.slice/libvirtd.service
           ├─  31947 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           ├─  31948 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           └─2329357 /usr/sbin/libvirtd --timeout 120

2. try to get information about the guest
# virsh guestinfo win10 

3. check libvirtd again
# systemctl status libvirtd 
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-04-15 04:44:36 EDT; 37s ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 2329357 (libvirtd)
    Tasks: 19 (limit: 32768)
   Memory: 1.8G
   CGroup: /system.slice/libvirtd.service
           ├─  31947 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           ├─  31948 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           └─2329357 /usr/sbin/libvirtd --timeout 120

No log like the following appeared:
kernel: libvirtd[2328747]: segfault at 0 ip 00007f4b35060747 sp 00007f4b71113650 error 4 in libvirt_driver_qemu.so[7f4b34f55000+1b7000]

As the testing result matches with the expected result, mark the bug as verified.

Comment 9 errata-xmlrpc 2020-05-05 09:59:00 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://access.redhat.com/errata/RHBA-2020:2017


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