sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #01666
[Bug 1844455] [NEW] Memory leak of struct _virPCIDeviceAddress on libvirt
You have been subscribed to a public bug by Guilherme G. Piccoli (gpiccoli):
[Impact]
* There's a long-term memory leak in libvirt related to the PCI information gathering from sysfs in Linux, specially related with SR-IOV devices. This was fixed by commit 38816336 ("node_device_conf: Don't leak @physical_function in virNodeDeviceGetPCISRIOVCaps") [ libvirt.org/git/?p=libvirt.git;a=commit;h=38816336 ].
* In comment #9 there is a detailed explanation of what's going on, but
the summary is that the variable physical_function (member of a PCI
structure), of type _virPCIDeviceAddress, is allocated on
virPCIGetDeviceAddressFromSysfsLink() and should be freed before reuse
in virNodeDeviceGetPCISRIOVCaps(), but it wasn't before the fix was
introduced.
* The impact of the issue is a memory leak usually small but that may
grow bigger depending on the amount of PCI devices and how/when they are
enumerated by libvirt; if some user of those functions are actively
exercising the leak path it may become a problem (OOM situation).
[Test Case]
* The basic testing done to exercise the memory leak path was running the virsh tool to generate the XML output of a SR-IOV PCI device in a loop, like:
while true; do virsh nodedev-dumpxml pci_0000_08_12_0 >/dev/null; done
* This was executed while Valgrind was used to debug libvirtd, in order
to collect the signature of the leak. Without the patch we get the
"definitely lost" type of leak with the PCI backtrace (on comment #9),
whereas with the patch we don't see the leak anymore.
[Regression Potential]
* The potential of regressions is really low - the fix is upstream for a while and in Focal package, and it is self-contained and not intrusive. Considering hypothetical scenarios, if there's an issue with the fix it should come in form of unused memory or double-free (which is usually harmless), and only in PCI enumeration (or PCI XML generation) paths.
** Affects: cloud-archive
Importance: Undecided
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: Confirmed
** Affects: cloud-archive/mitaka
Importance: Undecided
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: Confirmed
** Affects: libvirt (Ubuntu)
Importance: High
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: Fix Released
** Affects: libvirt (Ubuntu Xenial)
Importance: High
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: In Progress
** Affects: libvirt (Ubuntu Bionic)
Importance: High
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: In Progress
** Affects: libvirt (Ubuntu Eoan)
Importance: High
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: In Progress
** Affects: libvirt (Ubuntu Focal)
Importance: High
Assignee: Guilherme G. Piccoli (gpiccoli)
Status: Fix Released
** Tags: sts sts-sponsor-dgadomski
--
Memory leak of struct _virPCIDeviceAddress on libvirt
https://bugs.launchpad.net/bugs/1844455
You received this bug notification because you are a member of STS Sponsors, which is subscribed to the bug report.