Oliver Kurth [Fri, 15 Sep 2017 18:23:28 +0000 (11:23 -0700)]
Map certain PAM errors to VGAUTH_E_AUTHENTICATION_DENIED.
VGAuth maps most PAM errors to VGAUTH_E_FAIL. As a result,
some authentication failures result in error messages reporting
general failure rather than authentication failure. To
provide more useful error reporting, this change maps most
PAM errors to VGAUTH_E_AUTHENTICATION_DENIED instead.
Oliver Kurth [Fri, 15 Sep 2017 18:23:27 +0000 (11:23 -0700)]
Exclude non-directory and non-existing paths during quiescing.
A stale mount point or a special path that can't be opened
could break quiescing operation in the Linux guest. We need
to tolerate such cases by skipping such paths.
Oliver Kurth [Fri, 15 Sep 2017 18:23:27 +0000 (11:23 -0700)]
Add Posix_Free and try harder to avoid clearing errno
free() can clear errno. Apparently POSIX will prohibit that
in a future version of the standard; in the meantime, add a
Posix_Free function that guarantees errno preservation and
start using it.
Similarly, make Util_ZeroFree, Util_FreeList, etc. also
preserve errno.
Oliver Kurth [Fri, 15 Sep 2017 18:23:26 +0000 (11:23 -0700)]
Allow enabling or disabling timesync multiple times.
Toolbox cmd sends a presumed old value for timesync GuestRpc
when enabling or disabling timesync. VMX side expects the guest
side to be aware of old value and therefore errors out whenever
guest repeats the operation. Previously the implementation was
silently ignoring the error.
Avoid sending the guestRpc to enable or disable timesync when
it is already in the desired state (enabled or disabled respectively).
It is optimal and also avoids the unnecessary error.
Oliver Kurth [Fri, 15 Sep 2017 18:23:26 +0000 (11:23 -0700)]
Fix build breakage introduced in hostinfo hypervisor detection changes.
ARM builds are breaking because Hostinfo_HypervisorPresent is defined
but not used [-Werror=unused-function]. This change defines
Hostinfo_HypervisorPresent only for i386 and x86_64 architectures.
Oliver Kurth [Fri, 15 Sep 2017 18:23:26 +0000 (11:23 -0700)]
HgfsServer: Rename the directory change notify callback to be more consistent.
When setting a directory notification request we pass a callback for receiving
directory change events which is currently poorly named. This simply renames
the callback to be HgfsServerNotifyReceiveEventCb. This is being done for
consistency and clarity when called by the notification component.
Oliver Kurth [Fri, 15 Sep 2017 18:23:26 +0000 (11:23 -0700)]
Disable building VGAuth, deployPkg, grabbitmqProxy by default on non-Linux.
VGAuth, deployPkg and grabbitmqProxy are not supported/tested for non-Linux
guests. Tar installer does not even install these components on these guests.
In order to avoid having non-Linux open-vm-tools users (like FreeBSD) go
through disabling these manually, use the correct default in configure script.
Oliver Kurth [Fri, 15 Sep 2017 18:23:25 +0000 (11:23 -0700)]
Fixes for VThread change
Two fixes for build issues
- numVCPU.c: Windows compiler apparently doesn't like empty
initalizer lists. Fill in with a value.
- vthreadBase.c: when VTHREAD_INVALID_ID went from -1 to 0,
missed some adjustment code in VThreadBaseSetLocal and
VThreadBaseGetLocal which "adjusted" the value by +1/-1 so
default-zero would work correctly. The value no longer needs
adjustment. This did not impact Linux because Linux uses
have a thread-local cache which returned before this slow path.
Two tiny but wide-ranging changes.
- Now that there are no remaining users of VTHREAD_MAX_THREADS outside
the lib/thread library itself, reduce the scope of that declaration
to vthreadInt.h.
- Change VTHREAD_INVALID_ID to a value of 0 instead of a value of ~0.
(And correspondingly, bump the ~4 hard-coded VThreadIDs that remain).
This reflects that the ID may now be default-initialized.
Oliver Kurth [Fri, 15 Sep 2017 18:23:25 +0000 (11:23 -0700)]
Move VThread_CurName() entirely to thread-local storage
A previous change switched VThreadBase to store thread names in
thread-local storage on most platforms (all except mobile). This
change is the follow-up: removing the old storage location for
thread names.
Briefly, this change removes the "name" field from VThreadBaseData and
handles all the fallout. That's mostly straightforward, though
lib/thread ended up storing a thread name in the "reserved" thread
structures - this is mostly so the name passed to VThread_ReserveID
would be preserved until VThread_CreateThread is called.
After this, vthreadBase.c complexity only remains for VThreadIDs, which
is the next step of this effort.
Oliver Kurth [Fri, 15 Sep 2017 18:23:25 +0000 (11:23 -0700)]
Check the RPC return value in timesync enable/disable commands.
toolbox-cmd timesync enable/disable commands always return success
even when the command failed. Added a check for the return value of
the RPC call and also print the error message using a generic
message which required renaming existing "disk.wiper.error" key.
Oliver Kurth [Fri, 15 Sep 2017 18:23:25 +0000 (11:23 -0700)]
VThread: put thread names in thread-local storage
Next step in the "stop allocating per-thread memory" effort. This change
moves thread name storage to thread-local storage. (VThreadIDs are
the hardest and will come last). This is also only half the work; a
it adds new storage but does not remove the old storage, which was
left out to keep this change simpler.
For platforms that have thread-local storage, the implementation is
pretty straightforward, though initialization is inherently lazy.
For platforms lacking thread-local storage (at this point: iOS and
Android, see comment in vthreadBase.c), life is much harder. Added
a very large comment contemplating different solutions and
ultimately concluding that unnamed threads on such a platform will
get a best-effort (read: racy) name from a global buffer. Note that
threads which are explicitly named WILL get a (non-racy) name, but
it requires an explicit naming attempt.
Oliver Kurth [Fri, 15 Sep 2017 18:23:25 +0000 (11:23 -0700)]
Multiple changes:
lib/file/file.c: - Add new function File_ContainSymLink().
lib/file/filePosix.c: - Add new function File_GetMountPath()
lib/include/file.h: - Add new function declarations.
lib/include/dynbuf.h:
- Clean up documentation.
- Rename DynBuf_ConcatString() to DynBuf_Strcat().
- New inline static function DynBuf_GetString().
lib/misc/dynbuf.c:
- Clean up documentation comments.
- New function DynBuf_DetachString().
lib/misc/hostinfoPosix.c:
- Utilize new DynBuf functions.
lib/misc/strutil.c:
- Clarify documentaion comments based on DynBuf changes.
lib/misc/utilMem.c:
- Adjustment to comments.
Common source file changeis; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:24 +0000 (11:23 -0700)]
Tools Daemon: Do not use kernel client mount HGFS when FUSE unavailable
When FUSE is not installed in new OS versions that are kernel 4.0 and newer
the vmhgfs-fuse client is unavailable to use. Previously, the mount RPC handler
would fall back to mounting Shared Folders using the kernel client.
This really should not be done as it would entail the user running with an
untested vmhgfs kernel driver client or worse the driver fails to build.
Instead the RPC should really fail to mount.
The RPC Mount Shared Folders should only mount the Shared Folders using the
kernel client when FUSE is not supported by our HGFS FUSE client i.e., when
the Linux kernel version is older than 4.0.
To check for these conditions the vmhgfs-fuse component is run with the enabled
option which returns with success for enabled, 1 for not enabled (older OS kernel)
and 2 for newer kernel but FUSE is missing. These return values should be checked
and only if value 1 is returned then the mount using the kernel client should be
attempted. Not as currently done with an unsuccessful result of 1 or 2.
This matches the installer which does the same check.
This fix is related to a bug which came about due to a user custom building
and installing a newer kernel 4.0+ on top of a 3.x kernel with tools, and without FUSE.
When the VM was rebooted using the 4.0+ kernel and running tools config script the
script will to try and use the HGFS kernel client.
The tools daemon RPC handler to mount the Shared Folders will also use the kernel
client, too, in this scenario.
This is bad as the HGFS kernel client is running untested by VMware.
Both issues need to be closed, this change addresses the tools daemon RPC handler only.
Oliver Kurth [Fri, 15 Sep 2017 18:23:23 +0000 (11:23 -0700)]
Remove TICKS_TO_USECS and USECS_TO_TICKS from poll.h
Back before tickless kernels (which we now always require on Linux),
there was a 50Hz-200Hz kernel "tick" for timekeeping. It is no longer
used in our code.
Oliver Kurth [Fri, 15 Sep 2017 18:23:22 +0000 (11:23 -0700)]
Consume VMware Tools Header files from Tools build.
The 'tools' build component publishes the VMware Tools header file as
'vmtools_version.h'. All products / components which consume 'tools'
should be built with the header file published by the 'tools' build
instead of the one archived in the include directory.
Oliver Kurth [Fri, 15 Sep 2017 18:23:20 +0000 (11:23 -0700)]
Thaw filesystems if the snapshot commit message to VMX fails
If it takes a long time to freeze filesystems, vmx may timeout the
snapshot operation so the commit fails. After this happens we should
thaw the frozen filesystems.
Oliver Kurth [Fri, 15 Sep 2017 18:23:20 +0000 (11:23 -0700)]
Remove several LoadLibrary calls
All the callsites in this change use LoadLibrary to
work around functions not being present in Win2K or WinXP.
We no longer support those platforms, so can link directly
to the correct functions w/o dynamic loading.
Oliver Kurth [Fri, 15 Sep 2017 18:23:19 +0000 (11:23 -0700)]
Fix the help message for --disable-xml-security-c option.
The help message printed for '--disable-xml-security-c' option is wrong. The
existing help message is best suited for '--enable-xml-security-c'.
1. Modified the help message to show the option as '--enable-xmlsecurity'
2. Modified the option name from --xx-xml-security-c to --xx-xmlsecurity
in order to maintain consistency between --disable/enable and
--with/without options.
Oliver Kurth [Fri, 15 Sep 2017 18:23:19 +0000 (11:23 -0700)]
Add Atomic_ReadIfEqualWrite128
This enables atomic CAS of a 128 bit entity. As gcc >= 4.6 already
provides intristics for it, the funciton is just a simple wrapper,
and built only for those compliers.
Oliver Kurth [Fri, 15 Sep 2017 18:23:19 +0000 (11:23 -0700)]
Add Atomic_ReadIfEqualWrite128
It enables atomic CAS of a 128 bit entity. As gcc >= 4.6 already
provides intristics for it, the funciton is just a simple wrapper,
and built only for those compliers.
Oliver Kurth [Fri, 15 Sep 2017 18:23:19 +0000 (11:23 -0700)]
Changes in file.c File_GetSizeEx() to be 64 bit compatible and treat the
size of temporary file that disappears between the File_ListDirectory() and
File_GetSize() calls as size 0.
Common header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:18 +0000 (11:23 -0700)]
Hgfs Linux: Fix mounter versioning constants
Currently, to allow for the mount information structure, which is passed
from the user mode mounter application to the Linux and OSX HGFS kernel
mode drivers, to be modified and support backwards compatibility, the
structure is versioned. However, the version field uses a badly named
constant implying it is the HGFS protocol version. This now clashes with
a new enum for the HGFS protocol version added for tracking and reporting
the protocol version in use. The mount information structure version
should have the version constants named for their intended purpose
e.g. HGFS_MOUNTINFO_VERSION.
This change modifies the contant and uses an enum. This effects the mounter
and HGFS kernel and OSX kernel mode components.
Oliver Kurth [Fri, 15 Sep 2017 18:23:18 +0000 (11:23 -0700)]
Build resolutionCommon when KMS is enabled
When ./configure is called with the '--without-x' option,
the resolutionKMS plugin failed to build because disabling
X disabled resolutionCommon as well. This changes enables
resolutionCommon when either X or KMS are enabled, or both.
Oliver Kurth [Fri, 15 Sep 2017 18:23:18 +0000 (11:23 -0700)]
Fix help messages related to xerces and xmlsecurity libraries.
When configuring open-vm-tools, if the system doesn't have
xmlsecurity and xerces libraries, the 'configure' step stops and
gives a hint that the user should try with '--without-xerces-c'
and '--without-xml-security-c' options. Those options are wrong
and the right ones are '--without-xmlsecurity' and '--without-xerces'.
Fixed the configure.ac script to print the proper '--without-xxxx'
messages in the warnings.
Oliver Kurth [Fri, 15 Sep 2017 18:23:18 +0000 (11:23 -0700)]
Reset gGuestInfoLastGatherTime on channel reset.
Reset gGuestInfoLastGatherTime on a channel reset
to avoid unnecessary warning during resume and snapshot restore.
Also rename global variables vmResumed -> gVMResumed and
guestInfoLastGatherTime -> gGuestInfoLastGatherTime.
Oliver Kurth [Fri, 15 Sep 2017 18:23:18 +0000 (11:23 -0700)]
Hgfs Protocol: remove unused constants for version
Create a new protocol version enum for subsequent use and remove the
unused constants and one misnamed clashing constant.
The misnamed one for MountInfo will be fixed in a subsequent change.