[libvirt] crash in virDomainNumaGetMemorySize

With current master (56945e1), while toying around with a WS2008R2 Hyper-V host: root@probook:~ # gdb --quiet -ex 'r -c hv dumpxml all-sles12-dev' -ex bt -ex detach -ex quit virsh Reading symbols from virsh...Reading symbols from /usr/lib/debug/usr/bin/virsh.debug...done. done. Starting program: /usr/bin/virsh -c hv dumpxml all-sles12-dev [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Enter Administrator's password for optiplex.fritz.box: [New Thread 0x7fffee601700 (LWP 26921)] Program received signal SIGSEGV, Segmentation fault. virDomainNumaGetMemorySize (numa=0x0) at conf/numa_conf.c:971 971 for (i = 0; i < numa->nmem_nodes; i++) #0 virDomainNumaGetMemorySize (numa=0x0) at conf/numa_conf.c:971 #1 0x00007ffff793bce0 in virDomainDefGetMemoryActual (def=def@entry=0x55555582ead0) at conf/domain_conf.c:7857 #2 0x00007ffff7948978 in virDomainDefFormatInternal (def=0x55555582ead0, flags=0, buf=buf@entry=0x7fffffffdde0) at conf/domain_conf.c:21677 #3 0x00007ffff794b8bc in virDomainDefFormat (def=<optimized out>, flags=<optimized out>) at conf/domain_conf.c:22507 #4 0x00007ffff7a94c33 in hypervDomainGetXMLDesc (domain=<optimized out>, flags=0) at hyperv/hyperv_driver.c:882 #5 0x00007ffff79b5351 in virDomainGetXMLDesc (domain=domain@entry=0x5555558237a0, flags=0) at libvirt-domain.c:2591 #6 0x000055555558b978 in cmdDumpXML (ctl=0x7fffffffe1c0, cmd=<optimized out>) at virsh-domain.c:9634 #7 0x000055555557d04f in vshCommandRun (ctl=0x7fffffffe1c0, cmd=0x555555822580) at vsh.c:1212 #8 0x0000555555579a4d in main (argc=5, argv=0x7fffffffe3c8) at virsh.c:921 Detaching from program: /usr/bin/virsh, process 26917 root@probook:~ # rpm -qf `which virsh` libvirt-client-20150917T085913.56945e1-3.xen_unstable.1.x86_64 Olaf

On Fri, Sep 18, 2015 at 17:10:20 +0200, Olaf Hering wrote:
With current master (56945e1), while toying around with a WS2008R2 Hyper-V host:
root@probook:~ # gdb --quiet -ex 'r -c hv dumpxml all-sles12-dev' -ex bt -ex detach -ex quit virsh Reading symbols from virsh...Reading symbols from /usr/lib/debug/usr/bin/virsh.debug...done. done. Starting program: /usr/bin/virsh -c hv dumpxml all-sles12-dev [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Enter Administrator's password for optiplex.fritz.box: [New Thread 0x7fffee601700 (LWP 26921)]
Program received signal SIGSEGV, Segmentation fault. virDomainNumaGetMemorySize (numa=0x0) at conf/numa_conf.c:971 971 for (i = 0; i < numa->nmem_nodes; i++) #0 virDomainNumaGetMemorySize (numa=0x0) at conf/numa_conf.c:971 #1 0x00007ffff793bce0 in virDomainDefGetMemoryActual (def=def@entry=0x55555582ead0) at conf/domain_conf.c:7857 #2 0x00007ffff7948978 in virDomainDefFormatInternal (def=0x55555582ead0, flags=0, buf=buf@entry=0x7fffffffdde0) at conf/domain_conf.c:21677 #3 0x00007ffff794b8bc in virDomainDefFormat (def=<optimized out>, flags=<optimized out>) at conf/domain_conf.c:22507 #4 0x00007ffff7a94c33 in hypervDomainGetXMLDesc (domain=<optimized out>, flags=0) at hyperv/hyperv_driver.c:882 #5 0x00007ffff79b5351 in virDomainGetXMLDesc (domain=domain@entry=0x5555558237a0, flags=0) at libvirt-domain.c:2591 #6 0x000055555558b978 in cmdDumpXML (ctl=0x7fffffffe1c0, cmd=<optimized out>) at virsh-domain.c:9634 #7 0x000055555557d04f in vshCommandRun (ctl=0x7fffffffe1c0, cmd=0x555555822580) at vsh.c:1212 #8 0x0000555555579a4d in main (argc=5, argv=0x7fffffffe3c8) at virsh.c:921 Detaching from program: /usr/bin/virsh, process 26917 root@probook:~ # rpm -qf `which virsh` libvirt-client-20150917T085913.56945e1-3.xen_unstable.1.x86_64
Hmm, looks like hyperv isn't initializing the "def->numa" field, but virDomainNumaGetMemorySize is expecting it. I actually have a patchset almost ready that should fix this along with other things. I hope to send the patches soon. Peter

On Fri, Sep 18, 2015 at 17:10:20 +0200, Olaf Hering wrote:
With current master (56945e1), while toying around with a WS2008R2 Hyper-V host:
Hi, thanks for reporting this. I've (hopefully) fixed the issue with: commit 403e86067d5cb3a6fd8583cb5b08121151bd4d9f Author: Peter Krempa <pkrempa@redhat.com> Date: Thu Aug 13 16:39:28 2015 +0200 conf: Pre-calculate initial memory size instead of always calculating it Add 'initial_memory' member to struct virDomainMemtune so that the memory size can be pre-calculated once instead of inferring it always again and again. Separating of the fields will also allow finer granularity of decisions in later patches where it will allow to keep the old initial memory value in cases where we are handling incomming migration from older versions that did not always update the size from NUMA as the code did previously. The change also requires modification of the qemu memory alignment function since at the point where we are modifying the size of NUMA nodes the total size needs to be recalculated too. The refactoring done in this patch also fixes a crash in the hyperv driver that did not properly initialize def->numa and thus virDomainNumaGetMemorySize(def->numa) crashed. In summary this patch should have no functional impact at this point. Peter

On Tue, Oct 13, Peter Krempa wrote:
On Fri, Sep 18, 2015 at 17:10:20 +0200, Olaf Hering wrote:
With current master (56945e1), while toying around with a WS2008R2 Hyper-V host: Hi, thanks for reporting this. I've (hopefully) fixed the issue with:
commit 403e86067d5cb3a6fd8583cb5b08121151bd4d9f Author: Peter Krempa <pkrempa@redhat.com> Date: Thu Aug 13 16:39:28 2015 +0200
conf: Pre-calculate initial memory size instead of always calculating it
Yes, virsh does not crash anymore. Thanks! Olaf
participants (2)
-
Olaf Hering
-
Peter Krempa