Bug 682249

Summary: more memory bugs in libvirt
Product: Red Hat Enterprise Linux 6 Reporter: Eric Blake <eblake>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: ajia, dallan, dyuan, eblake, gren, gsun, kxiong, mjenner, xen-maint, yoyzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.8.7-10.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 679164 Environment:
Last Closed: 2011-05-19 13:28:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 656795, 679164    
Bug Blocks:    

Description Eric Blake 2011-03-04 15:39:39 UTC
another memleak fix was posted upstream after bug 679164 had already been verified.  By cloning, I've made both bz's reference each other, so that any backporting doesn't forget to pull in all the changes.

+++ This bug was initially created as a clone of Bug #679164 +++

Description of problem:
valgrind reports the use of uninitialized memory affecting libvirtd execution, as well as several leaks directly attributable to libvirt

Latest upstream leak patch:

https://www.redhat.com/archives/libvir-list/2011-March/msg00180.html

Comment 3 Eric Blake 2011-03-04 17:18:57 UTC
In POST:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-March/msg00108.html

Among other leaks, this can be tested with:

valgrind --leak-check=full virsh
virsh # cd
virsh # quit

which used to leak a string the size of the user's HOME directory.

Comment 5 zhanghaiyan 2011-03-08 03:53:29 UTC
Reproduced this bug with older package libvirt-0.8.7-8.el6.x86_64
# valgrind --leak-check=full virsh
==3042== Memcheck, a memory error detector
==3042== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==3042== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==3042== Command: virsh
==3042== 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # cd

virsh # quit

==3042== 
==3042== HEAP SUMMARY:
==3042==     in use at exit: 103,940 bytes in 224 blocks
==3042==   total heap usage: 512 allocs, 288 frees, 1,555,339 bytes allocated
==3042== 
==3042== 6 bytes in 1 blocks are definitely lost in loss record 2 of 53
==3042==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==3042==    by 0x3E1D27FD91: strdup (in /lib64/libc-2.12.so)
==3042==    by 0x4C5DC38: ??? (in /usr/lib64/libvirt.so.0.8.7)
==3042==    by 0x40A92B: ??? (in /usr/bin/virsh)
==3042==    by 0x416819: ??? (in /usr/bin/virsh)
==3042==    by 0x41F1DE: ??? (in /usr/bin/virsh)
==3042==    by 0x3E1D21EC9C: (below main) (in /lib64/libc-2.12.so)
==3042== 
==3042== LEAK SUMMARY:
==3042==    definitely lost: 6 bytes in 1 blocks
==3042==    indirectly lost: 0 bytes in 0 blocks
==3042==      possibly lost: 0 bytes in 0 blocks
==3042==    still reachable: 103,934 bytes in 223 blocks
==3042==         suppressed: 0 bytes in 0 blocks
==3042== Reachable blocks (those to which a pointer was found) are not shown.
==3042== To see them, rerun with: --leak-check=full --show-reachable=yes
==3042== 
==3042== For counts of detected and suppressed errors, rerun with: -v
==3042== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 6 from 6)


Verified this bug PASS with the fixed package libvirt-0.8.7-10.el6.x86_64
# valgrind --leak-check=full virsh
==2831== Memcheck, a memory error detector
==2831== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==2831== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==2831== Command: virsh
==2831== 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # cd

virsh # quit

==2831== 
==2831== HEAP SUMMARY:
==2831==     in use at exit: 103,854 bytes in 217 blocks
==2831==   total heap usage: 505 allocs, 288 frees, 1,555,242 bytes allocated
==2831== 
==2831== LEAK SUMMARY:
==2831==    definitely lost: 0 bytes in 0 blocks
==2831==    indirectly lost: 0 bytes in 0 blocks
==2831==      possibly lost: 0 bytes in 0 blocks
==2831==    still reachable: 103,854 bytes in 217 blocks
==2831==         suppressed: 0 bytes in 0 blocks
==2831== Reachable blocks (those to which a pointer was found) are not shown.
==2831== To see them, rerun with: --leak-check=full --show-reachable=yes
==2831== 
==2831== For counts of detected and suppressed errors, rerun with: -v
==2831== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)

Comment 6 zhanghaiyan 2011-03-08 04:00:07 UTC
- kernel-2.6.32-118.el6.x86_64
- qemu-kvm-0.12.1.2-2.149.el6.x86_64
- valgrind-3.6.0-3.el6.x86_64
- libnl-1.1-13.el6.x86_64

Comment 9 errata-xmlrpc 2011-05-19 13:28:36 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html