John Wolfe [Mon, 9 Nov 2020 20:29:03 +0000 (12:29 -0800)]
Add a usage message for the "checkvm" utility.
This change alters the functionality of the -h option to print a
usage message by using glib options. The previous functionality of -h
was to print hardware version, which prints invalid results. This
change also removes a repeated header file and removes the -r option
which prints invalid results.
John Wolfe [Mon, 9 Nov 2020 20:29:03 +0000 (12:29 -0800)]
Change the default Unicode error errno.
In times long past, EINVAL was chosen for the errno returned when a
Unicode problem was detected. This overloads EINVAL, particularly when
using POSIX system calls. Unfortunately, the overloading makes it very
difficult to recover from some errors as there is no way to know the
difference between a "real" EINVAL and a Unicode problem EINVAL.
Over 10 years of data shows that we *RARELY* encounter Unicode errors.
Inspecting the source base shows the code segments that do check for
errno after an error either:
1) Post the errno value and die.
2) Have switch handle cases but also have a default catcher.
3) Have an if/else waterfall with a final else.
Another observation is that Unicode routines are not involved with
anything that would return a math related errno (e.g. ERANGE, EDOM).
Changing the value of UNICODE_CONVERSION_ERRNO to ERANGE and avoid
any overloading.
John Wolfe [Tue, 27 Oct 2020 00:29:54 +0000 (17:29 -0700)]
Fix memory leaks.
A Coverity scan of open-vm-tools reported a number of memory leaks
on error code paths. Fix seven reported leaks, and modify code
to address two false positives in order to make the code clearer
and/or keep Coverity from reporting the issues. Also fix additional
leaks found in the routine Proto_TextContents during code review.
John Wolfe [Tue, 27 Oct 2020 00:29:54 +0000 (17:29 -0700)]
Update vm_basic_types.h for apple silicon
Apple silicon compilers will define __arm64__ as their
name for their new CPU. But they also define __aarch64__ which
existing 64-bit ARM CPUs use. Add a little bit of logic
to enforce and document this.
John Wolfe [Tue, 27 Oct 2020 00:29:53 +0000 (17:29 -0700)]
[GlobalConf] Support for vmusr service to load Global Configuration.
Currently, the vmsvc service periodically downloads the Global Configuration
from the GuestStore and applies the downloaded configuration. 'vmusr'
service doesn't have the support. In this changeset, made the changes
for both vmusr and vmsvc services to periodically check and apply
the changes.
To keep thing simple and easy, the new approach is check the
modification time every time the regular tools conf is read and if
changes are detected, the configuration is applied. With this new approach,
signalling mechanism is not needed and that code is removed.
vmsvc:
* Starts a background thread which periodically fetches the global
configuration from the GuestStore.
vmusr:
* No background thread is created. But checks and loads the configuration
everytime the regular tools.conf is checked.
John Wolfe [Tue, 13 Oct 2020 21:00:59 +0000 (14:00 -0700)]
Fix memory leaks in guestInfo/diskInfo.c.
When checking for IDE, SATA and SAS disk drives, the glib GMatchInfo is
passed to a g_regex_match() function inside a for loop. It was not
properly passed to g_match_info_free() before subsequently being reused.
This addresses https://github.com/vmware/open-vm-tools/issues/452
John Wolfe [Tue, 6 Oct 2020 21:30:54 +0000 (14:30 -0700)]
Adding the vgauthImport utility to open-vm-tools.
The vmware-alias-import utility is not currently packaged with the
open-vm-tools bundle; this change adds the utility. It is built
only if vgauth is enabled.
John Wolfe [Tue, 22 Sep 2020 21:54:07 +0000 (14:54 -0700)]
Fix the exit code when toolbox-cmd disk shrink is canceled.
The toolbox-cmd disk shrink operation was exiting with status 0
when a SIGINT is received. A non-zero exit status is expected.
Change the exit code to 130, which is the appropriate value
according to TLDP: https://tldp.org/LDP/abs/html/exitcodes.html
John Wolfe [Tue, 22 Sep 2020 21:54:07 +0000 (14:54 -0700)]
Fix memory leaks in guestInfo/diskInfo.c.
When checking for IDE, SATA and SAS disk drives, the glib GMatchInfo is
passed to a g_regex_match() function inside a for loop. It was not
properly passed to g_match_info_free() before subsequently being reused.
This addresses https://github.com/vmware/open-vm-tools/issues/452
John Wolfe [Fri, 11 Sep 2020 19:11:05 +0000 (12:11 -0700)]
hostinfo.h: stop including x86cpuid.h
With the removal of Hostinfo_GetAllCpuid in an earlier change, hostinfo.h
can stop including x86cpuid.h and only needs vendor IDs from x86vendor.h.
Unfortunately, quite a few source files depended in hostinfo.h's automatic
inclusion of x86cpuid.h. Fix them to include what they need.
The lib/include/guestStats.h is a special case that happened to succeed because
of a warning that was disabled in x86cpuid.h which also happens to have
been included earlier than this header. Re-disable the warning.
John Wolfe [Fri, 11 Sep 2020 19:11:05 +0000 (12:11 -0700)]
Ensuring vmtools utilities are only used in a VMware virtual environment.
Several utilities do not check that their running environment is in a
VMware hypervisor. Add checks and generate error messages if the
running environment is a physical machine. Some makefiles were altered
o resolve dependency issues.