I think I found the problem and it seems to affect only Windows guests.
I'm not sure about the cause tough.
Possible causes:
1- Network interface names containing white spaces.
2- One of the interfaces not reporting a MAC address.
As an example here is the output of the equivalent virsh command for a
Windows guest:
Name MAC address Protocol Address
-------------------------------------------------------------------------------
Ethernet 2 52:54:00:99:b5:62 ipv6 fe80::71fd:2467:8755:cb0b%13/64
Ethernet 2 52:54:00:99:b5:62 ipv4 192.168.0.77/26
Loopback Pseudo-Interface 1 ipv6 ::1/128
Loopback Pseudo-Interface 1 ipv4 127.0.0.1/8
isatap.{974B556C-9BAF-4A84-A1B1-9D1FDABEC29B} 00:00:00:00:00:00 ipv6
fe80::5efe:192.168.7.21%12/128
Please note the name containing white spaces: "Ethernet 2", "Loopback
Pseudo-Interface 1". And also interface "Loopback Pseudo-Interface 1"
not reporting a MAC address.
Hope this additional information helps.
Thanks.
Fernando
On mié, abr 15, 2020 at 11:41 PM, Fernando Casas Schössow
<casasfernando(a)outlook.com> wrote:
Hi,
While executing libvirt_domain_interface_addresses() with the
qemu-agent running in the guest as the source, the function causes
PHP to segfault. If I change the source to either dhcp or arp, the
function executes correctly.
Example:
$netdetails = libvirt_domain_interface_addresses($vmres, 0); <--
executes correctly (dhcp source)
$netdetails = libvirt_domain_interface_addresses($vmres, 1); <--
segfault (qemu agent source)
$netdetails = libvirt_domain_interface_addresses($vmres, 2); <--
executes correctly (arp source)
I tested the equivalent function using virsh against the same host
and it executes correctly with any source.
I have a php-cgi core file that I can share if that may help on
finding the problem.
gdb output:
GNU gdb (Debian 9.1-2) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<
http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<
http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<
http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/php-cgi...
(No debugging symbols found in /usr/bin/php-cgi)
[New LWP 2594]
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php-cgi index.php'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:85
85 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
(gdb) bt
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:85
#1 0x000055c6a4ceacd2 in add_assoc_string_ex ()
#2 0x00007f4d36175253 in ?? () from
/usr/lib/php/20180731/libvirt-php.so
#3 0x000055c6a4d6b477 in execute_ex ()
#4 0x000055c6a4d705c7 in zend_execute ()
#5 0x000055c6a4ce8ed4 in zend_execute_scripts ()
#6 0x000055c6a4c8be38 in php_execute_script ()
#7 0x000055c6a4b53da8 in ?? ()
#8 0x00007f4d39efce0b in __libc_start_main (main=0x55c6a4b51cf0,
argc=2, argv=0x7fff35718588, init=<optimized out>, fini=<optimized
out>,
rtld_fini=<optimized out>, stack_end=0x7fff35718578) at
../csu/libc-start.c:308
#9 0x000055c6a4b544ca in _start ()
System information:
OS: Debian Bullseye
PHP version (fast cgi): 7.3.15
Libvirt PHP version: 0.5.5
Libvirt version: 6.0.0
KVM host libvirt version: 5.9.0
If you need any other information please let me know.
Thanks.
Fernando