pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/57983: open-vm-tools file descriptor leak
>Number: 57983
>Category: pkg
>Synopsis: open-vm-tools file descriptor leak
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 02 12:55:00 +0000 2024
>Originator: Jarle Fredrik Greipsland
>Release: NetBSD 10.0_RC4
>Organization:
Vennlig hilsen
Jarle Fredrik Greipsland
>Environment:
System: NetBSD aaa.bbb.ccc.ddd 10.0_RC4 NetBSD 10.0_RC4 (GENERIC) #3: Thu Feb 22 17:41:47 CET 2024 jarle%aaa.bbb.ccc.ddd@localhost:/build/netbsd-10/amd64/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
On a newly created VM on a VMware hypervisor, I compiled, installed
and started vmtoolsd from pkgsrc' sysutils/open-vm-tools package.
Some hours later the vmtoolsd process had reached its limit with
regards to the permitted number of open file descriptors.
In its default configuration vmtoolsd will try and retrieve
information from /etc/resolv.conf or similar every 30 seconds. In a
Unix-like environment it does this by calling res_ninit, and then
extricate various pieces of information from the data stored in the
struct __res_state variable. When done, it does a res_nclose on the
variable.
Unfortunately, in NetBSD, the res_ninit function has the (unusual, but
documented) side effect that it will keep an open file descriptor for
the /etc/resolv.conf file, and even allocate a kevent descriptor as
well, in order to catch updates to the file. res_nclose does not free
these resources. So the process will leak 2 descriptors every 30
seconds.
>How-To-Repeat:
Install and run vmtoolsd on a VMware hosted VM.
>Fix:
For NetBSD, when done with the resolver object, use res_ndestroy
instead of res_nclose to release any allocated resources. Patch
below.
diff -u lib/nicInfo/nicInfoPosix.c.orig lib/nicInfo/nicInfoPosix.c
--- lib/nicInfo/nicInfoPosix.c.orig 2024-03-01 17:37:32.813014060 +0100
+++ lib/nicInfo/nicInfoPosix.c 2024-03-01 17:38:38.906276921 +0100
@@ -898,14 +898,22 @@
*/
nicInfo->dnsConfigInfo = dnsConfigInfo;
+#if defined(__NetBSD__)
+ res_ndestroy(&res);
+#else
res_nclose(&res);
+#endif
return TRUE;
fail:
VMX_XDR_FREE(xdr_DnsConfigInfo, dnsConfigInfo);
free(dnsConfigInfo);
+#if defined(__NetBSD__)
+ res_ndestroy(&res);
+#else
res_nclose(&res);
+#endif
return FALSE;
}
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index