RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1325043 - libvirt forget free priv->machineName when clear guest resource
Summary: libvirt forget free priv->machineName when clear guest resource
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-08 03:33 UTC by Luyao Huang
Modified: 2016-11-03 18:41 UTC (History)
2 users (show)

Fixed In Version: libvirt-1.3.4-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:41:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Luyao Huang 2016-04-08 03:33:45 UTC
Description of problem:
libvirt forget free priv->machineName when clear guest resource

Version-Release number of selected component (if applicable):
libvirt-1.3.3-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. setup valgrind 

# valgrind --leak-check=full libvirtd

2. start guest but fail:

# virsh start rhel7.0-rhel
error: Failed to start domain rhel7.0-rhel
error: internal error: process exited while connecting to monitor: 2016-04-08T03:30:30.832952Z qemu-kvm: -object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,size=1053818880: memory size 0x3ed00000 must be equal to or larger than huge page size 0x40000000


3. valgrind info

==31007== 3,300 bytes in 3 blocks are definitely lost in loss record 690 of 704
==31007==    at 0x4C29BFD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==31007==    by 0x4C2BACB: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==31007==    by 0x54ABDBF: virReallocN (viralloc.c:245)
==31007==    by 0x54AE993: virBufferGrow (virbuffer.c:130)
==31007==    by 0x54AEE4A: virBufferVasprintf (virbuffer.c:388)
==31007==    by 0x54AEFD3: virBufferAsprintf (virbuffer.c:361)
==31007==    by 0x550FAE3: virSystemdMakeMachineName (virsystemd.c:161)
==31007==    by 0x1E646623: qemuInitCgroup (qemu_cgroup.c:822)
==31007==    by 0x1E646623: qemuSetupCgroup (qemu_cgroup.c:979)
==31007==    by 0x1E65EA31: qemuProcessLaunch (qemu_process.c:5311)
==31007==    by 0x1E6627C1: qemuProcessStart (qemu_process.c:5570)
==31007==    by 0x1E6BF147: qemuDomainObjStart.constprop.47 (qemu_driver.c:7195)
==31007==    by 0x1E6BF885: qemuDomainCreateWithFlags (qemu_driver.c:7249)


Actual results:

memleak on priv->machineName

Expected results:

no memleak

Additional info:

Comment 1 Martin Kletzander 2016-04-11 12:27:47 UTC
Fixed upstream with v1.3.3-53-g16b41728b59a:

commit 16b41728b59a7188f643937303e3aec4c299a980
Author: Martin Kletzander <mkletzan>
Date:   Fri Apr 8 15:29:40 2016 +0200

    qemu: Free priv->machineName

Comment 3 Luyao Huang 2016-08-09 08:46:39 UTC
Verify this bug with libvirt-2.0.0-4.el7.x86_64:

1. setup valgrind 

# valgrind --leak-check=full libvirtd

2. start guest but fail:

# virsh start r7
error: Failed to start domain r7
error: internal error: process exited while connecting to monitor: 2016-08-09T08:37:15.133793Z qemu-kvm: -object memory-backend-file,id=ram-node1,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,size=536870912,host-nodes=0-1,policy=bind: memory size 0x20000000 must be equal to or larger than page size 0x40000000

3. check valgrind report, although there is another memory leak in this report, it will be another problem

^C==4306== 
==4306== HEAP SUMMARY:
==4306==     in use at exit: 522,939 bytes in 6,202 blocks
==4306==   total heap usage: 116,468 allocs, 110,266 frees, 180,424,060 bytes allocated
==4306== 
==4306== 48 bytes in 1 blocks are definitely lost in loss record 420 of 642
==4306==    at 0x4C29975: calloc (vg_replace_malloc.c:711)
==4306==    by 0x54B118C: virAllocN (viralloc.c:191)
==4306==    by 0x552E12A: virDomainUSBAddressHubNew (domain_addr.c:1384)
==4306==    by 0x5530C34: virDomainUSBAddressSetAddController (domain_addr.c:1422)
==4306==    by 0x5530C34: virDomainUSBAddressSetAddControllers (domain_addr.c:1547)
==4306==    by 0x21FFCE39: qemuDomainAssignUSBAddresses (qemu_domain_address.c:1741)
==4306==    by 0x21FFCE39: qemuDomainAssignAddresses (qemu_domain_address.c:1791)
==4306==    by 0x22012FA5: qemuProcessPrepareDomain (qemu_process.c:4885)
==4306==    by 0x2201A2DF: qemuProcessStart (qemu_process.c:5460)
==4306==    by 0x220761E7: qemuDomainObjStart.constprop.48 (qemu_driver.c:7059)
==4306==    by 0x22076925: qemuDomainCreateWithFlags (qemu_driver.c:7113)
==4306==    by 0x55C3E3B: virDomainCreate (libvirt-domain.c:6787)
==4306==    by 0x14AF7A: remoteDispatchDomainCreate (remote_dispatch.h:4116)
==4306==    by 0x14AF7A: remoteDispatchDomainCreateHelper (remote_dispatch.h:4092)
==4306==    by 0x562F931: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
==4306==    by 0x562F931: virNetServerProgramDispatch (virnetserverprogram.c:307)
==4306== 
==4306== LEAK SUMMARY:
==4306==    definitely lost: 48 bytes in 1 blocks
==4306==    indirectly lost: 0 bytes in 0 blocks
==4306==      possibly lost: 0 bytes in 0 blocks
==4306==    still reachable: 522,891 bytes in 6,201 blocks
==4306==         suppressed: 0 bytes in 0 blocks
==4306== Reachable blocks (those to which a pointer was found) are not shown.
==4306== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==4306== 
==4306== For counts of detected and suppressed errors, rerun with: -v
==4306== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Comment 5 errata-xmlrpc 2016-11-03 18:41:23 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://rhn.redhat.com/errata/RHSA-2016-2577.html


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