John Wolfe [Fri, 31 Jul 2020 20:36:34 +0000 (13:36 -0700)]
GOSC event doesn't report at once after customization process timer is reached
When process timer is reached, the command process is killed and function
ProcessRead is called to read all the output till EOF. But EOF can't be
reached immediately. The reason is pre-customization script is launched
by perl script, and killing perl script process doesn't kill the
pre-customization script process.
This code update includes:
1. Do not read stdout/stderr when gosc command process exits abnormally
to avoid the EOF blocking.
2. Add READSTATUS_PENDING_TO_EOF in enum ReadStatus to avoid the confusion
with READSTATUS_PENDING.
3. Close the write ends of pipes (stdout[1]/stderr[1]) for child command
process before it exists.
4. In processPosix.c, the write ends of pipes have been closed in line 180,
181, so the read ends should be closed in line 254, 255.
5. Add explicit note for the beginning and the end of the perl script log.
John Wolfe [Tue, 21 Jul 2020 18:53:01 +0000 (11:53 -0700)]
Fix memory leak issue for "vmtoolsd" binary on receiving SIGINT or SIGUSR1.
Valgrind complains of a memory leak issue on receiving SIGINT or SIGUSR1
signal, because we lost call to RpcIn_Destruct(chan->in) in
RpcChannelTeardown(). It just happens to be released only at service
shutdown or on receiving SIGUSR1 signal; not a major concern.
Cleaning up the code.
Linux arm64 does not implement iopl() and the Hostinfo_ResetProcessState()
is raising a NOT_IMPLEMENTED() because of that. However if there's no iopl(),
there is no reason to drop IO privileges, so we can just skip that code.
This change also restores usage of getloadavg() for non Android arm64
platforms: ESX vmx and tools for Linux arm64.
Oliver Kurth [Fri, 12 Jun 2020 03:43:21 +0000 (20:43 -0700)]
Code cleanup to address a Coverity issue.
Coverity reports a "dereference after NULL check" in
BkdoorChannelStart. However, at the point of dereference
it's known that chan->inStarted is TRUE, which means chan->in
is guaranteed to be non-NULL, so it's not a bug.
Still, given that an input channel, if present, must have been
started before calling BkdoorChannelStart, it's possible to do
some code cleanup that will also get Coverity to stop reporting
the issue. Change what's currently a test into an ASSERT, test
chan->in rather than chan->inStarted, and add comments to make
it clearer what's going on.
Oliver Kurth [Fri, 12 Jun 2020 03:43:20 +0000 (20:43 -0700)]
Correct an issue reported by Coverity.
lib/asyncsocket/asyncsocket.c:
- AsyncSocket_SetKeepAlive() calls AsyncSocket_GetFd() which may return
a negative result. If that should happen, simply return FALSE.
Oliver Kurth [Wed, 10 Jun 2020 19:05:46 +0000 (12:05 -0700)]
open-vm-tools: add distribution specific pam config files
Add distribution specific pam config files for Debian/Ubuntu,
SuSE and Redhat/Fedora/CentOS. Install a generic file by default,
with comments to KB article. The distribution files are intended
to be used by OS vendors in their open-vm-tools packages.
Oliver Kurth [Wed, 10 Jun 2020 19:05:46 +0000 (12:05 -0700)]
Improve Linux guest identification function documentation.
Make it clear that the "short name" of a Linux distro has a default
value and that the default value should not be overwritten unless
VMware does this.
If someone cheats and sends down an unsupported "short name", the
guestMapper will protect the software stack, mapping the unsupported
"short name" to that of the guestOS config found in the VMX file.
We know that is OK since the VM couldn't power on and run the guest
unless it was valid.
All older, supported ESXi have updates that contain the guestMapper.
If the guestMapper is not in place - an older, unpatched release -
the software stack can become confused causing problems and crashes.
Oliver Kurth [Wed, 10 Jun 2020 19:05:45 +0000 (12:05 -0700)]
Pick up the LSB distro file for ALT Linux
Improve the documentation of the Linux identification routine so others
know that nothing needs to be changed in the field.
Only VMware needs to add identification codes.
Oliver Kurth [Wed, 10 Jun 2020 19:05:45 +0000 (12:05 -0700)]
SDMP plugin logs warning message every 5 minute if there is no
Namespace DB instance created on a VM. Changing the log level to
debug to solve the problem.
Oliver Kurth [Wed, 10 Jun 2020 19:05:45 +0000 (12:05 -0700)]
Implement Set_option handler in appInfo plugin.
* Added a handler for the Set_option for appInfo plugin.
The poll loop will be immediately turned off when the feature
is turned off at the host side.
The poll loop will be immediately turned on when the feature
is turned on at the host side.
* Added the code to handle VM vmotion to an older host that
doesn't have logic to send 'set_option'.
Oliver Kurth [Wed, 10 Jun 2020 19:05:44 +0000 (12:05 -0700)]
Fix a Coverity-reported NULL pointer issue.
Check whether a pointer is NULL before dereferencing it. Also
updated a stale comment, edited a couple of other comments for
line length, and deleted some trailing white space.
1. Environment variable 'ALIVE_BASE' is used to construct the path of
the file where vcops version is stored. The variable is not avialable
when running the script inside serviceDiscovery plugin process, so a
hardcoded path is used.
* GUESTLIB_HOST_MEM_KERN_OVHD_MB metric was already deprecated in ESXi
starting from 7.1. It's time to deprecate the corresponding
VMGuestLib_GetHostMemKernOvhdMB API in GuestSDK. The documentation
will be update denoting that this API is deprecated.
After one or two releases, the API will be removed completely.
Untill then, the API is modified to explicity return 0 for the metric.
* Only a few functions listed in vmGuestLib.h are exposed in the vmGuestLibJava
interface. The remaining functions are encapsulated in '#ifndef SWIG'
to hide them from SWIG utility which is used to generate the Java bindings.
Note: The external customer facing documentation for this API will be
documented later.
Note: Once this changeset is submitted, the vmStatsProvider module
will be updated to stop using the deprecated API.