Bug 2166573
| Summary: | Valgrind catched memory leaking in libvirt | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | liang cong <lcong> | ||||
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | ||||
| Status: | CLOSED ERRATA | QA Contact: | liang cong <lcong> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 8.8 | CC: | jdenemar, jsuchane, lmen, mhou, mprivozn, virt-maint | ||||
| Target Milestone: | rc | Keywords: | Triaged | ||||
| Target Release: | --- | Flags: | mhou:
needinfo-
pm-rhel: mirror+ |
||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | libvirt-8.0.0-16.module+el8.8.0+18111+4fb8618a | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2023-05-16 08:18:36 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | 9.0.0 | ||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 2144443 | ||||||
| Attachments: |
|
||||||
Yeah, this is fixed by the following upstream commit:
commit bca7a53333ead7c1afd178728de74c2977cd4b5e
Author: Michal Prívozník <mprivozn>
AuthorDate: Mon Oct 31 15:38:13 2022 +0100
Commit: Michal Prívozník <mprivozn>
CommitDate: Tue Nov 1 14:51:48 2022 +0100
qemu_namespace: Don't leak memory in qemuDomainGetPreservedMounts()
The aim of qemuDomainGetPreservedMounts() is to get a list of
filesystems mounted under /dev and optionally generate a path for
each one where they are moved temporarily when building the
namespace. And the function tries to be a bit clever about it.
For instance, if /dev/shm mount point exists, there's no need to
consider /dev/shm/a nor /dev/shm/b as preserving just 'top level'
/dev/shm gives the same result. To achieve this, the function
iterates over the list of filesystem as returned by
virFileGetMountSubtree() and removes the nested ones. However, it
does so in a bit clumsy way: plain VIR_DELETE_ELEMENT() is used
without freeing the string itself. Therefore, if all three
aforementioned example paths appeared on the list, /dev/shm/a and
/dev/shm/b strings would be leaked.
And when I think about it more, there's no real need to shrink
the array down (realloc()). It's going to be free()-d when
returning from the function. Switch to
VIR_DELETE_ELEMENT_INPLACE() then.
Fixes: cdd9205dfffa3aaed935446a41f0d2dd1357c268
Signed-off-by: Michal Privoznik <mprivozn>
Reviewed-by: Peter Krempa <pkrempa>
Reviewed-by: Ján Tomko <jtomko>
v8.9.0-35-gbca7a53333
Preverified on build: # rpm -q libvirt libvirt-8.0.0-16.el8_rc.ab10928bfa.x86_64 Verify steps: 1. Init steps 1.1 Edit libvirtd start cmd as below: # cat /usr/lib/systemd/system/libvirtd.service | grep ExecStart ExecStart=runcon system_u:system_r:virtd_t:s0-s0:c0.c1023 /usr/bin/valgrind --tool=memcheck --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=definite --log-file=/var/log/valgrind/libvirtd.log /usr/sbin/libvirtd $LIBVIRTD_ARGS 1.2 Restart service # systemctl daemon-reload # systemctl restart libvirtd notes:if hit error when restring libvirtd service then follow the instruction by cmd "journalctl -xe", run following cmd: # ausearch -c 'runcon' --raw | audit2allow -M my-runcon # semodule -X 300 -i my-runcon.pp Then restart libvirtd again # systemctl restart libvirtd 2. Start a guest # virsh start vm1 Domain 'vm1' started 3. Save the guest # virsh save vm1 vm1.save Domain 'vm1' saved to vm1.save 4. Restore the guest # virsh restore vm1.save Domain restored from vm1.save 5. Managedsave the guest # virsh managedsave vm1 Domain 'vm1' state saved by libvirt 6. Start the guest # virsh start vm1 Domain 'vm1' started 7. Destroy the guest # virsh destroy vm1 Domain 'vm1' destroyed 8. Then wait fro around 2 mins check the whole valgrind log, there is no memory leak related "definitely lost" found. ==42070== Memcheck, a memory error detector ==42070== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==42070== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==42070== Command: /usr/sbin/libvirtd --timeout 120 ==42070== Parent PID: 1 ==42070== ==42070== Warning: noted but unhandled ioctl 0xaea3 with no size/direction hints. ==42070== This could cause spurious value errors to appear. ==42070== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==42070== Warning: noted but unhandled ioctl 0x89a2 with no size/direction hints. ==42070== This could cause spurious value errors to appear. ==42070== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==42070== ==42070== HEAP SUMMARY: ==42070== in use at exit: 1,346,842 bytes in 15,226 blocks ==42070== total heap usage: 722,620 allocs, 707,394 frees, 1,583,289,870 bytes allocated ==42070== ==42070== LEAK SUMMARY: ==42070== definitely lost: 0 bytes in 0 blocks ==42070== indirectly lost: 0 bytes in 0 blocks ==42070== possibly lost: 3,056 bytes in 26 blocks ==42070== still reachable: 1,328,202 bytes in 15,090 blocks ==42070== of which reachable via heuristic: ==42070== length64 : 1,464 bytes in 30 blocks ==42070== newarray : 1,824 bytes in 34 blocks ==42070== suppressed: 0 bytes in 0 blocks ==42070== Reachable blocks (those to which a pointer was found) are not shown. ==42070== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==42070== ==42070== For lists of detected and suppressed errors, rerun with: -s ==42070== ERROR SUMMARY: 26 errors from 26 contexts (suppressed: 0 from 0) Hello Michal
I try to run some memory leak tests on rhel9.2. But I block when start virtqemud services. Do you have any idea? Here is my steps:
1. create valgrind log file.
mkdir /var/log/valgrind/
2. edit start command on /usr/lib/systemd/system/virtqemud.service
ExecStart=runcon system_u:system_r:virtd_t:s0-s0:c0.c1023 /usr/bin/valgrind --tool=memcheck --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=definite --log-file=/var/log/valgrind/libvirtd.log /usr/sbin/virtqemud $VIRTQEMUD_ARGS
systemctl daemon-reload
systemctl restart libvirtd
ausearch -c 'runcon' --raw | audit2allow -M my-runcon
semodule -X 300 -i my-runcon.pp
3. try to start virtqemud but failed.
# systemctl restart virtqemud
# systemctl status virtqemud
○ virtqemud.service - Virtualization qemu daemon
Loaded: loaded (/usr/lib/systemd/system/virtqemud.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2023-02-09 04:33:19 EST; 9min ago
TriggeredBy: × virtqemud-ro.socket
× virtqemud.socket
× virtqemud-admin.socket
Docs: man:libvirtd(8)
https://libvirt.org
Process: 9934 ExecStart=runcon system_u:system_r:virtd_t:s0-s0:c0.c1023 /usr/bin/valgrind --tool=memcheck --child-silent-a>
Main PID: 9934 (code=exited, status=126)
CPU: 2ms
Feb 09 04:33:19 dell-per740-77.rhts.eng.pek2.redhat.com systemd[1]: virtqemud.service: Scheduled restart job, restart counter >
Feb 09 04:33:19 dell-per740-77.rhts.eng.pek2.redhat.com systemd[1]: Stopped Virtualization qemu daemon.
Feb 09 04:33:19 dell-per740-77.rhts.eng.pek2.redhat.com systemd[1]: virtqemud.service: Start request repeated too quickly.
Feb 09 04:33:19 dell-per740-77.rhts.eng.pek2.redhat.com systemd[1]: virtqemud.service: Failed with result 'exit-code'.
Feb 09 04:33:19 dell-per740-77.rhts.eng.pek2.redhat.com systemd[1]: Failed to start Virtualization qemu daemon.
sorry for inconverience, the step 2 is restart virtqemud systemctl daemon-reload systemctl restart virtqemud After re-run below command, this issue is resolved. ausearch -c 'runcon' --raw | audit2allow -M my-runcon semodule -X 300 -i my-runcon.pp Performance test also hit oom call trace when use libvirt-8.0.0-15.module+el8.8.0+18023+bf5b754e.x86_64. stock kernel(kernel-4.18.0-465.el8) https://beaker.engineering.redhat.com/jobs/7523034 oom call trace log: https://beaker-archive.hosts.prod.psi.bos.redhat.com/beaker-logs/2023/02/75230/7523034/13377061/console.log realtime kernel(kernel-rt-4.18.0-465.rt7.251.el8) https://beaker.engineering.redhat.com/jobs/7521639 oom call trace: https://beaker-archive.hosts.prod.psi.bos.redhat.com/beaker-logs/2023/02/75216/7521639/13374619/console.log I try to start a guest on libvirt-8.0.0-17.module+el8.8.0+18133+90800a0a.x86_64. Guest can start as well, But can monitor warining message on valgrind. Please let me know, if I can ignore this warning message. [root@dell-per740-77 ~]# tail -f /var/log/valgrind/libvirtd.log ==5303== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==5303== Command: /usr/sbin/libvirtd --timeout 120 ==5303== Parent PID: 1 ==5303== ==5303== Warning: noted but unhandled ioctl 0xaea3 with no size/direction hints. ==5303== This could cause spurious value errors to appear. ==5303== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==5303== Warning: noted but unhandled ioctl 0x89a2 with no size/direction hints. ==5303== This could cause spurious value errors to appear. ==5303== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==5303== ==5303== HEAP SUMMARY: ==5303== in use at exit: 1,470,494 bytes in 19,145 blocks ==5303== total heap usage: 518,109 allocs, 498,964 frees, 1,572,283,676 bytes allocated ==5303== ==5303== LEAK SUMMARY: ==5303== definitely lost: 0 bytes in 0 blocks ==5303== indirectly lost: 0 bytes in 0 blocks ==5303== possibly lost: 3,056 bytes in 26 blocks ==5303== still reachable: 1,447,774 bytes in 18,989 blocks ==5303== of which reachable via heuristic: ==5303== length64 : 1,464 bytes in 30 blocks ==5303== newarray : 1,824 bytes in 34 blocks ==5303== suppressed: 0 bytes in 0 blocks ==5303== Reachable blocks (those to which a pointer was found) are not shown. ==5303== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==5303== ==5303== For lists of detected and suppressed errors, rerun with: -s ==5303== ERROR SUMMARY: 26 errors from 26 contexts (suppressed: 0 from 0) Here is the configuration about enable valgrind on libivrt service. # cat /usr/lib/systemd/system/libvirtd.service | grep ExecStart ExecStart=runcon system_u:system_r:virtd_t:s0-s0:c0.c1023 /usr/bin/valgrind --tool=memcheck --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=definite --log-file=/var/log/valgrind/libvirtd.log /usr/sbin/libvirtd $LIBVIRTD_ARGS (In reply to mhou from comment #10) > I try to start a guest on > libvirt-8.0.0-17.module+el8.8.0+18133+90800a0a.x86_64. Guest can start as > well, But can monitor warining message on valgrind. Please let me know, if I > can ignore this warning message. > > [root@dell-per740-77 ~]# tail -f /var/log/valgrind/libvirtd.log > ==5303== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info > ==5303== Command: /usr/sbin/libvirtd --timeout 120 > ==5303== Parent PID: 1 > ==5303== > ==5303== Warning: noted but unhandled ioctl 0xaea3 with no size/direction > hints. > ==5303== This could cause spurious value errors to appear. > ==5303== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a > proper wrapper. > ==5303== Warning: noted but unhandled ioctl 0x89a2 with no size/direction > hints. Yeah, this is harmless. ioctl() doesn't allocate any memory. I was unable to check what specific ioctl does this magic constant refers to, it's been very likely constructed via some bit shifts (and thus grep is powerless). Anyway, there's no memleak. Verified on build: # rpm -q libvirt libvirt-8.0.0-17.module+el8.8.0+18133+90800a0a.x86_64 Verify steps: 1. Init steps 1.1 Edit libvirtd start cmd as below: # cat /usr/lib/systemd/system/libvirtd.service | grep ExecStart ExecStart=runcon system_u:system_r:virtd_t:s0-s0:c0.c1023 /usr/bin/valgrind --tool=memcheck --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=definite --log-file=/var/log/valgrind/libvirtd.log /usr/sbin/libvirtd $LIBVIRTD_ARGS 1.2 Restart service # systemctl daemon-reload # systemctl restart libvirtd notes:if hit error when restring libvirtd service then follow the instruction by cmd "journalctl -xe", run following cmd: # ausearch -c 'runcon' --raw | audit2allow -M my-runcon # semodule -X 300 -i my-runcon.pp Then restart libvirtd again # systemctl restart libvirtd 2. Create a guest # virsh create vm1.xml Domain 'vm1' created from vm1.xml 3. Save the guest # virsh save vm1 vm1.save Domain 'vm1' saved to vm1.save 4. Restore the guest # virsh restore vm1.save Domain restored from vm1.save 5. Reboot the guest # virsh reboot vm1 Domain 'vm1' is being rebooted 6. Shutdown the guest # virsh shutdown vm1 Domain 'vm1' is being shutdown 7. Define the domain # virsh define vm1.xml Domain 'vm1' defined from vm1.xml 8. Start the guest # virsh start vm1 Domain 'vm1' started 9. Managedsave the guest # virsh managedsave vm1 Domain 'vm1' state saved by libvirt 10. Start the guest # virsh start vm1 Domain 'vm1' started 11. Destroy the guest # virsh destroy vm1 Domain 'vm1' destroyed 12. Then wait fro around 2 mins check the whole valgrind log, there is no memory leak related "definitely lost" found. ==42991== Memcheck, a memory error detector ==42991== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==42991== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==42991== Command: /usr/sbin/libvirtd --timeout 120 ==42991== Parent PID: 1 ==42991== ==42991== Warning: noted but unhandled ioctl 0xaea3 with no size/direction hints. ==42991== This could cause spurious value errors to appear. ==42991== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==42991== Warning: noted but unhandled ioctl 0x89a2 with no size/direction hints. ==42991== This could cause spurious value errors to appear. ==42991== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==42991== ==42991== HEAP SUMMARY: ==42991== in use at exit: 1,347,194 bytes in 15,233 blocks ==42991== total heap usage: 818,116 allocs, 802,883 frees, 1,602,017,045 bytes allocated ==42991== ==42991== LEAK SUMMARY: ==42991== definitely lost: 0 bytes in 0 blocks ==42991== indirectly lost: 0 bytes in 0 blocks ==42991== possibly lost: 3,056 bytes in 26 blocks ==42991== still reachable: 1,328,554 bytes in 15,097 blocks ==42991== of which reachable via heuristic: ==42991== length64 : 1,464 bytes in 30 blocks ==42991== newarray : 1,824 bytes in 34 blocks ==42991== suppressed: 0 bytes in 0 blocks ==42991== Reachable blocks (those to which a pointer was found) are not shown. ==42991== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==42991== ==42991== For lists of detected and suppressed errors, rerun with: -s ==42991== ERROR SUMMARY: 26 errors from 26 contexts (suppressed: 0 from 0) Mark it verified per comment 12 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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), 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://access.redhat.com/errata/RHSA-2023:2757 |
Created attachment 1941733 [details] vm1.xml Description of problem: Valgrind catched memory leak in libvirt when start&destroy, Version-Release number of selected component (if applicable): libvirt-8.0.0-15.module+el8.8.0+18023+bf5b754e.x86_64 How reproducible: 100% Steps to Reproduce: 1. Init steps: 1.1 Edit libvirtd start cmd as below: # cat /usr/lib/systemd/system/libvirtd.service | grep ExecStart ExecStart=runcon system_u:system_r:virtd_t:s0-s0:c0.c1023 /usr/bin/valgrind --tool=memcheck --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=definite --log-file=/var/log/valgrind/libvirtd.log /usr/sbin/libvirtd $LIBVIRTD_ARGS 1.2 Restart service # systemctl daemon-reload # systemctl restart libvirtd notes:if hit error when restring libvirtd service then follow the instruction by cmd "journalctl -xe", run following cmd: # ausearch -c 'runcon' --raw | audit2allow -M my-runcon # semodule -X 300 -i my-runcon.pp Then restart libvirtd again # systemctl restart libvirtd 2. Test scenarios 2.1 Scenario1: Start a guest and destroy a guest 2.1.1 Start a guest with domain config xml from attachment vm1.xml # virsh start vm1 Domain 'vm1' started 2.1.2 Wait for around 1 min then destroy vm1 # virsh destroy vm1 Domain 'vm1' destroyed 2.1.3 Then wait fro around 2 mins check the whole valgrind log # cat /var/log/valgrind/libvirtd.log ==44834== Memcheck, a memory error detector ==44834== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==44834== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==44834== Command: /usr/sbin/libvirtd --timeout 120 ==44834== Parent PID: 1 ==44834== ==44834== Warning: noted but unhandled ioctl 0xaea3 with no size/direction hints. ==44834== This could cause spurious value errors to appear. ==44834== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==44834== Warning: noted but unhandled ioctl 0x89a2 with no size/direction hints. ==44834== This could cause spurious value errors to appear. ==44834== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==44834== ==44834== HEAP SUMMARY: ==44834== in use at exit: 1,345,915 bytes in 15,219 blocks ==44834== total heap usage: 551,480 allocs, 536,261 frees, 1,559,753,097 bytes allocated ==44834== ==44834== 45 bytes in 4 blocks are definitely lost in loss record 1,622 of 2,852 ==44834== at 0x4C38135: malloc (vg_replace_malloc.c:381) ==44834== by 0x59255E5: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.4) ==44834== by 0x593F2D2: g_strdup (in /usr/lib64/libglib-2.0.so.0.5600.4) ==44834== by 0x4F27B90: virFileGetMountSubtreeImpl (virfile.c:1997) ==44834== by 0x336C82A5: qemuDomainGetPreservedMounts (qemu_namespace.c:140) ==44834== by 0x336C8693: qemuNamespaceMknodPaths (qemu_namespace.c:1266) ==44834== by 0x336C9B4D: qemuDomainBuildNamespace (qemu_namespace.c:677) ==44834== by 0x336D4E1B: qemuProcessLaunch (qemu_process.c:7517) ==44834== by 0x336DA204: qemuProcessStart (qemu_process.c:7834) ==44834== by 0x33677AC4: qemuDomainObjStart.constprop.59 (qemu_driver.c:6365) ==44834== by 0x336780FE: qemuDomainCreateWithFlags (qemu_driver.c:6416) ==44834== by 0x5146256: virDomainCreate (libvirt-domain.c:6721) ==44834== ==44834== LEAK SUMMARY: ==44834== definitely lost: 45 bytes in 4 blocks ==44834== indirectly lost: 0 bytes in 0 blocks ==44834== possibly lost: 3,056 bytes in 26 blocks ==44834== still reachable: 1,327,230 bytes in 15,079 blocks ==44834== of which reachable via heuristic: ==44834== length64 : 1,464 bytes in 30 blocks ==44834== newarray : 1,824 bytes in 34 blocks ==44834== suppressed: 0 bytes in 0 blocks ==44834== Reachable blocks (those to which a pointer was found) are not shown. ==44834== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==44834== ==44834== For lists of detected and suppressed errors, rerun with: -s ==44834== ERROR SUMMARY: 27 errors from 27 contexts (suppressed: 0 from 0) 2.2 Scenario2: Start a guest, save&restore, destroy a guest 2.2.1 Start a guest with domain config xml from attachment vm1.xml # virsh start vm1 Domain 'vm1' started 2.2.2 Save a guest # virsh save vm1 vm1.save Domain 'vm1' saved to vm1.save 2.2.3 Restore the guest # virsh restore vm1.save Domain restored from vm1.save 2.2.4 Destroy the guest vm1 # virsh destroy vm1 Domain 'vm1' destroyed 2.2.5 Then wait fro around 2 mins check the whole valgrind log # cat /var/log/valgrind/libvirtd.log ==46209== Memcheck, a memory error detector ==46209== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==46209== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==46209== Command: /usr/sbin/libvirtd --timeout 120 ==46209== Parent PID: 1 ==46209== ==46209== Warning: noted but unhandled ioctl 0xaea3 with no size/direction hints. ==46209== This could cause spurious value errors to appear. ==46209== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==46209== Warning: noted but unhandled ioctl 0x89a2 with no size/direction hints. ==46209== This could cause spurious value errors to appear. ==46209== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==46209== ==46209== HEAP SUMMARY: ==46209== in use at exit: 1,346,757 bytes in 15,232 blocks ==46209== total heap usage: 635,892 allocs, 620,660 frees, 1,571,293,461 bytes allocated ==46209== ==46209== 45 bytes in 4 blocks are definitely lost in loss record 1,626 of 2,862 ==46209== at 0x4C38135: malloc (vg_replace_malloc.c:381) ==46209== by 0x59255E5: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46209== by 0x593F2D2: g_strdup (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46209== by 0x4F27B90: virFileGetMountSubtreeImpl (virfile.c:1997) ==46209== by 0x336C82A5: qemuDomainGetPreservedMounts (qemu_namespace.c:140) ==46209== by 0x336C8693: qemuNamespaceMknodPaths (qemu_namespace.c:1266) ==46209== by 0x336C9B4D: qemuDomainBuildNamespace (qemu_namespace.c:677) ==46209== by 0x336D4E1B: qemuProcessLaunch (qemu_process.c:7517) ==46209== by 0x336DA204: qemuProcessStart (qemu_process.c:7834) ==46209== by 0x33677AC4: qemuDomainObjStart.constprop.59 (qemu_driver.c:6365) ==46209== by 0x336780FE: qemuDomainCreateWithFlags (qemu_driver.c:6416) ==46209== by 0x5146256: virDomainCreate (libvirt-domain.c:6721) ==46209== ==46209== 45 bytes in 4 blocks are definitely lost in loss record 1,627 of 2,862 ==46209== at 0x4C38135: malloc (vg_replace_malloc.c:381) ==46209== by 0x59255E5: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46209== by 0x593F2D2: g_strdup (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46209== by 0x4F27B90: virFileGetMountSubtreeImpl (virfile.c:1997) ==46209== by 0x336C82A5: qemuDomainGetPreservedMounts (qemu_namespace.c:140) ==46209== by 0x336C8693: qemuNamespaceMknodPaths (qemu_namespace.c:1266) ==46209== by 0x336C9B4D: qemuDomainBuildNamespace (qemu_namespace.c:677) ==46209== by 0x336D4E1B: qemuProcessLaunch (qemu_process.c:7517) ==46209== by 0x336DA204: qemuProcessStart (qemu_process.c:7834) ==46209== by 0x336DEB2E: qemuSaveImageStartVM (qemu_saveimage.c:628) ==46209== by 0x3366C61D: qemuDomainRestoreFlags (qemu_driver.c:5835) ==46209== by 0x51352FC: virDomainRestore (libvirt-domain.c:974) ==46209== ==46209== LEAK SUMMARY: ==46209== definitely lost: 90 bytes in 8 blocks ==46209== indirectly lost: 0 bytes in 0 blocks ==46209== possibly lost: 3,056 bytes in 26 blocks ==46209== still reachable: 1,328,027 bytes in 15,088 blocks ==46209== of which reachable via heuristic: ==46209== length64 : 1,464 bytes in 30 blocks ==46209== newarray : 1,824 bytes in 34 blocks ==46209== suppressed: 0 bytes in 0 blocks ==46209== Reachable blocks (those to which a pointer was found) are not shown. ==46209== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==46209== ==46209== For lists of detected and suppressed errors, rerun with: -s ==46209== ERROR SUMMARY: 28 errors from 28 contexts (suppressed: 0 from 0) 2.3 Scenario3: Start a guest, managedsave&start, destroy a guest 2.3.1 Start a guest with domain config xml from attachment vm1.xml # virsh start vm1 Domain 'vm1' started 2.3.2 Managedsave the guest # virsh managedsave vm1 Domain 'vm1' state saved by libvirt 2.3.3 Start the guest # virsh start vm1 Domain 'vm1' started 2.3.4 Destroy the guest vm1 # virsh destroy vm1 Domain 'vm1' destroyed 2.3.5 Then wait fro around 2 mins check the whole valgrind log # cat /var/log/valgrind/libvirtd.log ==46656== Memcheck, a memory error detector ==46656== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==46656== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==46656== Command: /usr/sbin/libvirtd --timeout 120 ==46656== Parent PID: 1 ==46656== ==46656== Warning: noted but unhandled ioctl 0xaea3 with no size/direction hints. ==46656== This could cause spurious value errors to appear. ==46656== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==46656== Warning: noted but unhandled ioctl 0x89a2 with no size/direction hints. ==46656== This could cause spurious value errors to appear. ==46656== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. ==46656== ==46656== HEAP SUMMARY: ==46656== in use at exit: 1,346,613 bytes in 15,231 blocks ==46656== total heap usage: 638,432 allocs, 623,201 frees, 1,571,656,369 bytes allocated ==46656== ==46656== 45 bytes in 4 blocks are definitely lost in loss record 1,625 of 2,861 ==46656== at 0x4C38135: malloc (vg_replace_malloc.c:381) ==46656== by 0x59255E5: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46656== by 0x593F2D2: g_strdup (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46656== by 0x4F27B90: virFileGetMountSubtreeImpl (virfile.c:1997) ==46656== by 0x336C82A5: qemuDomainGetPreservedMounts (qemu_namespace.c:140) ==46656== by 0x336C8693: qemuNamespaceMknodPaths (qemu_namespace.c:1266) ==46656== by 0x336C9B4D: qemuDomainBuildNamespace (qemu_namespace.c:677) ==46656== by 0x336D4E1B: qemuProcessLaunch (qemu_process.c:7517) ==46656== by 0x336DA204: qemuProcessStart (qemu_process.c:7834) ==46656== by 0x33677AC4: qemuDomainObjStart.constprop.59 (qemu_driver.c:6365) ==46656== by 0x336780FE: qemuDomainCreateWithFlags (qemu_driver.c:6416) ==46656== by 0x5146256: virDomainCreate (libvirt-domain.c:6721) ==46656== ==46656== 45 bytes in 4 blocks are definitely lost in loss record 1,626 of 2,861 ==46656== at 0x4C38135: malloc (vg_replace_malloc.c:381) ==46656== by 0x59255E5: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46656== by 0x593F2D2: g_strdup (in /usr/lib64/libglib-2.0.so.0.5600.4) ==46656== by 0x4F27B90: virFileGetMountSubtreeImpl (virfile.c:1997) ==46656== by 0x336C82A5: qemuDomainGetPreservedMounts (qemu_namespace.c:140) ==46656== by 0x336C8693: qemuNamespaceMknodPaths (qemu_namespace.c:1266) ==46656== by 0x336C9B4D: qemuDomainBuildNamespace (qemu_namespace.c:677) ==46656== by 0x336D4E1B: qemuProcessLaunch (qemu_process.c:7517) ==46656== by 0x336DA204: qemuProcessStart (qemu_process.c:7834) ==46656== by 0x336DEB2E: qemuSaveImageStartVM (qemu_saveimage.c:628) ==46656== by 0x33677CC2: qemuDomainObjRestore (qemu_driver.c:6102) ==46656== by 0x33677CC2: qemuDomainObjStart.constprop.59 (qemu_driver.c:6343) ==46656== by 0x336780FE: qemuDomainCreateWithFlags (qemu_driver.c:6416) ==46656== ==46656== LEAK SUMMARY: ==46656== definitely lost: 90 bytes in 8 blocks ==46656== indirectly lost: 0 bytes in 0 blocks ==46656== possibly lost: 3,056 bytes in 26 blocks ==46656== still reachable: 1,327,883 bytes in 15,087 blocks ==46656== of which reachable via heuristic: ==46656== length64 : 1,464 bytes in 30 blocks ==46656== newarray : 1,824 bytes in 34 blocks ==46656== suppressed: 0 bytes in 0 blocks ==46656== Reachable blocks (those to which a pointer was found) are not shown. ==46656== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==46656== ==46656== For lists of detected and suppressed errors, rerun with: -s ==46656== ERROR SUMMARY: 28 errors from 28 contexts (suppressed: 0 from 0)