Re: [PATCH 01/10] memory: make it safer to expand arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 2010-11-18 12:28, Eric Blake Write:
> * src/util/memory.h (VIR_REALLOC_N): Update docs.
> (VIR_EXPAND_N, VIR_SHRINK_N): New macros.
> (virAlloc, virAllocN, virReallocN, virAllocVar, virFree): Add some
> gcc attributes.
> * src/util/memory.c (virExpandN, virShrinkN): New functions.
> (virReallocN): Update docs.
> * docs/hacking.html.in: Prefer newer interfaces over
> VIR_REALLOC_N, since uninitialized memory can bite us.
> * HACKING: Regenerate.
> * src/libvirt_private.syms: Export new helpers.
> ---
>  HACKING                  |   24 +++++++++++-------
>  docs/hacking.html.in     |   25 +++++++++++-------
>  src/libvirt_private.syms |    2 +
>  src/util/memory.c        |   59 +++++++++++++++++++++++++++++++++++++++++++++-
>  src/util/memory.h        |   51 +++++++++++++++++++++++++++++++++++----
>  5 files changed, 134 insertions(+), 27 deletions(-)
> 

There may be a bug in this patch.

When I use the newest libvirt, I find the following problem:

[root@localhost ~]# service libvirtd status
libvirtd (pid  4541) is running...
[root@localhost ~]# virsh start wency_vm1
error: cannot recv data: : Connection reset by peer
error: failed to connect to the hypervisor
[root@localhost ~]# service libvirtd status
libvirtd dead but pid file exists
[root@localhost ~]# 

Test the libvirtd without --dameon, I find that:
[root@localhost newest]# libvirtd 
Segmentation fault (core dumped)
[root@localhost newest]# 

The folling is the output of the command 'gdb libvirtd core':
[root@localhost newest]# gdb /usr/sbin/libvirtd core.8996 
<snip>
Core was generated by `libvirtd'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000041a181 in qemudDispatchServer (server=0x209dcd0, sock=<value optimized out>) at libvirtd.c:1459
1459	    server->clients[server->nclients++] = client;
<snip>
(gdb) bt
#0  0x000000000041a181 in qemudDispatchServer (server=0x209dcd0, sock=<value optimized out>) at libvirtd.c:1459
#1  0x000000000041a6f1 in qemudDispatchServerEvent (watch=5, fd=8, events=1, opaque=0x209dcd0) at libvirtd.c:2225
#2  0x0000000000415b71 in virEventDispatchHandles () at event.c:467
#3  virEventRunOnce () at event.c:592
#4  0x00000000004180e9 in qemudOneLoop () at libvirtd.c:2234
#5  0x00000000004183db in qemudRunLoop (opaque=0x209dcd0) at libvirtd.c:2343
#6  0x0000003ffec077e1 in start_thread () from /lib64/libpthread.so.0
#7  0x0000003ffe4e153d in clone () from /lib64/libc.so.6
(gdb) p server->clients
$2 = (struct qemud_client **) 0x0

I revert this patch and rebuild libvirt, the bug is not appreared.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]