Oliver Kurth [Mon, 26 Feb 2018 20:29:06 +0000 (12:29 -0800)]
Skip davfs mount points during quiescing (part 2)
Refactor the change to skip davfs mount points. Capture the length
of the static URL prefixes at compile time and avoid repetitive
strlen() calls when checking each active mount point.
Oliver Kurth [Mon, 26 Feb 2018 20:29:06 +0000 (12:29 -0800)]
Skip davfs mount points during quiescing
The davfs2 is a Linux filesystem that allows mounting a Web Distributed
Authoring and Versioning (WebDAV) network resource as a local filesystem.
On some Linux releases, the FREEZE ioctl() is rejected and quiescing
these filesystems is not attempted. On others, however, the FREEZE is
not rejected and there exists the potential of a quiescing deadlock
if the davfs2 attempts to write to its cache in /var which has already
been quiesced.
This fix is to avoid a potential deadlock by excluding davfs2 mounts
as the networking filesystem they are. Since davfs2 may be implemented
on the Linux fuse (default) or coda filesystem kernel module,
the detection of these network mounts must be based upon detection
of the URL prefix of the mounted device name.
The static function SyncDriverIsRemoteFSType() is being updated to
not only exclude remote filesystems based on filesystem type but also
to exclude davfs2 remote filesystems by the "http://" or "https://"
URL prefix on the device name. The function name is being changed
to SyncDriverIsRemoteFS().
Oliver Kurth [Mon, 26 Feb 2018 20:29:06 +0000 (12:29 -0800)]
vm_basic_types.h: scrub FMTxx specifiers
Reduce the amount of magic in vm_basic_types.h... nowadays, any
system we support (including Tools) DEFINITELY supports C99-style
specifiers, with two exceptions: pre-vs2015 MSVC, and pre-10.13
macOS kernels.
Rip out all the pre-C99 junk. Add a few comments explaining exactly
what the caveats here are.
Oliver Kurth [Mon, 26 Feb 2018 20:29:05 +0000 (12:29 -0800)]
Remove uses of header file safetime.h
- (many places) replace "safetime.h" with <time.h> and/or <sys/stat.h>,
occasionally re-ordering this header to top of file
- (many places) remove "safetime.h" as no time functions are used
Oliver Kurth [Thu, 8 Feb 2018 00:39:26 +0000 (16:39 -0800)]
Use a unique random temp directory for vmtoolsd on Linux.
The temporay directory currently used by vmtoolsd and its plugins
on Linux is of the form /tmp/vmware-<user>. Since it is used to
upload VMware Tools upgrade and GOS customization scripts and commands,
that name predictability may make it susceptible to attack. This
change adds a new function File_GetSafeRandomTmpDir() in
bora/lib/file/fileTempPosix.c to both add the PID to the user name
and add a random number suffix to the temp directory path.
/tmp/vmware-<user>_<pid>-nnnnnn
VMware Tools commands and plugins are being updated to use this random
temp directory.
Oliver Kurth [Thu, 8 Feb 2018 00:39:26 +0000 (16:39 -0800)]
open-vm-tools: ignore with/without gtk2/3 options when building without X
When building without X support, we should ignore the options to enable/disable
gtk2 and gtk3. This was reported in gthub issue
https://github.com/vmware/open-vm-tools/issues/228 .
Oliver Kurth [Wed, 7 Feb 2018 00:32:40 +0000 (16:32 -0800)]
open-vm-tools: use pkg-config for building with icu
icu uses pkg-config in recent versions, and no longer ships with
icu-config in most recent versions. Make the configure script
use pkg-config for icu if available, and icu-config if not. For
pkg-config we need to specify 'icui18n' which returns the same result
as icu-config did to link with icui18n.
Oliver Kurth [Wed, 7 Feb 2018 00:32:40 +0000 (16:32 -0800)]
Ignore ENXIO errors with SyncDriver
A quiesced snapshot fails when the target VM has a bind mount. The
problem is that the syncDriver gets an ENXIO error when it tries to
open the mount point. To fix the problem, let the quiesce operation
skip a mount point when opening it results in an ENXIO error.
This change is based on pull request
https://github.com/vmware/open-vm-tools/pull/218 .
Oliver Kurth [Wed, 7 Feb 2018 00:32:39 +0000 (16:32 -0800)]
open-vm-tools: use ENV{DEVTYPE}=="disk" in udev scsi rule
Fix udev scsi rule to not print warnings on boot.
The rule now checks for the device type. The previous fix by
trying to check for a valid timeout field did not work as expected.
This change uses the rule from Mike Latimer at
https://github.com/vmware/open-vm-tools/pull/216
Oliver Kurth [Wed, 7 Feb 2018 00:32:38 +0000 (16:32 -0800)]
guestOS identification: Tweak handling the LSB
The multi-standard handing code dealt with the LSB strictly. This
causes some issues with older distros that are not LSB compliant but
happened to work due to a specific behavior.
Return the LSB to "LSB and old way" and provide some specific coverage
of detaults to ensure coverage.
Oliver Kurth [Wed, 7 Feb 2018 00:32:38 +0000 (16:32 -0800)]
Restore "ufs" to the list of known filesystems
A previous change, 5074636, to remove "ufs" from the kernel also removed
"ufs" from the known list of Linux filesystems. As a result, the "ufs"
filesystems on FreeBSD and Solaris VMs cannot be seen and therefore
no disk information is available in vmsvc/get.guest output.
Oliver Kurth [Wed, 7 Feb 2018 00:32:37 +0000 (16:32 -0800)]
GuestOS: Support the os-release standard
While bringing up Amazon Linux as a guest, it was discovered that
Amazon Linux was not LSB compilant. The LSB standard defines a way
to uniquely determine which distro one is running on. Since our code
was based on the LSB standard, we made some changes to explicitly
detect Amazon Linux and handle it as a special case.
Amazon let us know that there is a "new" standard - os-release - which
they are compliant with. One must explicitly install Amazon Linux in a
special way to obtain the LSB compliance.
Researching the "new" standard, it turned out to not be that different
than the LSB standard. Further research showed that some distros (e.g.
Ubuntu) are releasing with both standards.
This change refactors the existing code, removes the explicit Amazon
Linux checking, and accepts the os-release standard. Amazon Linux then
"just falls out".
Oliver Kurth [Wed, 7 Feb 2018 00:32:37 +0000 (16:32 -0800)]
Reduce Vigor transport socket draining overhead
A previous change in VigorPollImpl and asyncsocket to fix a memory
leak that causes a performance regression for parallel reconfiguration of
running VMs (the kind requiring FSR). During an FSR, the connection
between hostd and the source vmx would drop and hostd would then
reconnect to the destination vmx. One source of regression is that
the buffer has to be drained when a disconnect happens and the draining
logic may potentially unregister and re-register the recv callback
multiple times. This change adds an asyncsocket function specifically
for draining recv that reduces the manipulation of callback. It
reduces the regression by up to ~50% (the effect is more pronounced with
more VMs).
Oliver Kurth [Wed, 7 Feb 2018 00:32:37 +0000 (16:32 -0800)]
Tools Hgfs Server Plugin: fix logging of client redirector handling functions
Modify logging of client redirector handling functions for starting the client
redirector kernel component and reconnecting mapped drives at services start
up. This changes the level from warning to info as these messages are purely
informational and not warnings of unexpected events or conditions.
Oliver Kurth [Wed, 7 Feb 2018 00:32:37 +0000 (16:32 -0800)]
Fix error reported by clang 6.0.0 - comparison 'int' <= 4294967295 is always true
Fix the logical constant compare warning/error in vixTools.c of the
vix plugin. Rewrite the continuous for loop to simply iterate from
zero to MAX_INT32.
Oliver Kurth [Wed, 7 Feb 2018 00:32:37 +0000 (16:32 -0800)]
Add VMware Tools 10.2.5 to vm_tools_version.h
- Add tools version 10.2.5 as the first scheduled tools 10.2.x
update - TOOLS_VERSION_CHAINSAW_UPDATE1
- Corrected a typo in a macro name in an earlier tools version
definition.
Oliver Kurth [Wed, 7 Feb 2018 00:32:37 +0000 (16:32 -0800)]
hostinfo: Identify Amazon Linux
Amazon Linux is not LSB compliant. Add a small amount of code such that
Amazon Linux can differentiated from all of other Linuxen and correctly
report its identifying data.
Oliver Kurth [Tue, 30 Jan 2018 00:52:19 +0000 (16:52 -0800)]
Set x11 as backend for gtk3 of open-vm-tools
Open-vm-tools defaults to gtk3, if available. For distros where wayland is
the default display server, plugins will try to use wayland as the backend
of gtk3. As a result, gdk_display_get_default() returns a wayland display,
and gdk_display_get_default_group() also returns a wayland window. Then,
applying GDK_WINDOW_XID() on the wayland window will result in crashes.
As x11-specific code is widely used in tools plugins, as a compromized
solution, force plugins to run on XWayland, which is the compatible mode
of wayland for legacy X11 clients.
gdk_set_allowed_backends() only applies when flag GTK3 is defined,
and the gtk version is over 3.10.
Oliver Kurth [Tue, 30 Jan 2018 00:52:18 +0000 (16:52 -0800)]
open-vm-tools: fix finding C++ compiler for cross-compiling
Patch contributed by Andrew Stormont (andy-js) on github:
https://github.com/vmware/open-vm-tools/pull/206 and
https://github.com/vmware/open-vm-tools/issues/92.
Oliver Kurth [Tue, 30 Jan 2018 00:52:18 +0000 (16:52 -0800)]
Change the glibc constraint to 2.11 from 2.12.
Earlier, a change was made to stop building open-vm-tools
for LINUX systems with glibc < 2.12 But SLES 11 SP4 which is
supported comes with glibc 2.11.3 The check will
block SLES 11 SP4 from moving to OVT 10.2.x To fix it, this change
relaxes the glibc constraint to 2.11.
Oliver Kurth [Tue, 30 Jan 2018 00:52:18 +0000 (16:52 -0800)]
Bump tools version to 10.2.5 on the vmtools-prod-cpd branch
Set the version for VMware Tools 10.2.x, Update 1 to 10.2.5.
This bump is to allow versions numbers for hot patches which may
be issued before the update is GA.
Oliver Kurth [Fri, 26 Jan 2018 23:04:36 +0000 (15:04 -0800)]
Set X11 as the backend for gtk3 of open-vm-tools
Open-vm-tools defaults to gtk3. For distros like Fedora 27, Wayland is
the default display server. With no restriction on the backend, plugins
will try to use Wayland as the backend of Gtk+3. As a result,
gdk_display_get_default() returns a Wayland display;
gdk_display_get_default_group() also returns a Wayland window. Applying
GDK_WINDOW_XID() on the Wayland window will result in the crash reported
on recent Linux releases that default to a Wayland display server.
As X11-specific code is widely used in tools plugins, a migratation to
Wayland in the short term is not possible. So, as a compromised solution,
plugins can be forced to run on XWayland, which is the compatible mode
of Wayland for legacy X11 clients.
gdk_set_allowed_backends() only applies when flag GTK3 is defined, and Gtk
version cwgreater than 3.10.
Oliver Kurth [Fri, 26 Jan 2018 23:04:36 +0000 (15:04 -0800)]
hostinfo: More prep work for Amazon Linux support
Amazon Linux is not LSB compliant but it does have a file that is
much like an LSB compliant release (name=value pairs). Make the names
of the structures generic... the logic can be reused for Amazon Linux
in a follow up change.
Oliver Kurth [Fri, 26 Jan 2018 23:04:36 +0000 (15:04 -0800)]
Refactor HostinfoOSData...
Refactor the HostinfoOsData in several smaller and simpler routines.
This will make it easier to maintain in the future (it was pretty
unwieldy already) and easier to add the logic for a non-LSB Linux.
More refactoring and actually adding the Amazon recognition code will
follow.
Oliver Kurth [Fri, 26 Jan 2018 23:04:35 +0000 (15:04 -0800)]
Changes to common source files:
lib/asyncsocket/asyncsocket.c: Use ASSERT instead of VERIFY when removings
poll callback in AsyncSocketCancelRecv.
lib/include/vm_product_versions.h: Change not applicable to open-vm-tools.
Oliver Kurth [Fri, 26 Jan 2018 23:04:35 +0000 (15:04 -0800)]
Change the glibc constraint to 2.11 from 2.12.
Earlier, we made a change to stop building open-vm-tools
for LINUX systems with glibc < 2.12 But SLES 11 SP4 which is
supported comes with glibc 2.11.3 The check will
block SLES 11 SP4 from moving to OVT 10.2.x To fix it, this change
relaxes the glibc constraint to 2.11.
Oliver Kurth [Fri, 26 Jan 2018 23:04:35 +0000 (15:04 -0800)]
Hgfs: remove Hgfs VMCI transport header from linux open-vm-tools
Linux Hgfs clients do not use the VMCI module for a transport and have
since migrated to a FUSE implementation. Therefore we do not need to
include the Hgfs VMCI transport header file.
Oliver Kurth [Fri, 26 Jan 2018 23:04:35 +0000 (15:04 -0800)]
Hgfs Server: fix error result for new dir creation in the virtual folder
The Hgfs server code detects when a client tries to create a new folder in the
virtual folder containing the VMware Shares. This is not allowed as only the
host can add new Shares which appears in this folder. The current error code
returned to the client in these cases is access denied. This is only correct
when the new folder does not collide with an existing share. This stops clients
treating the virtual folder as a regular read/write physical folder. However,
for the case where the name collides, the access denied error is not correct,
as it does not tell the client the folder already exists. This causes some
applications to fail as they expect to see this error if the path component
exists as that is okay and expected. At this point the application will continue
to traverse the path and ensure the next component exists or if not create that.
To ensure that applications don't prematurely fail and can test that the share
still exists in the path the Hgfs server should return HGFS_ERROR_FILE_EXIST
and leave HGFS_ERROR_ACCESS_DENIED for all other cases.
Oliver Kurth [Fri, 26 Jan 2018 23:04:35 +0000 (15:04 -0800)]
Hgfs: get rid of vmware_pack_begin and vmware_pack_end header files
Get rid of vmware_pack_begin and vmware_pack_end header files and
replace with the pragma pack and pop. This code currently only
affects Windows clients and the VMX HGFS VMCI transport.
Oliver Kurth [Fri, 5 Jan 2018 22:47:15 +0000 (14:47 -0800)]
Get rid of convertutf and bsd_printf for all non-Win VMware Tools
The MsgFmt_* functions are referenced in a few utilities
related to VMware Tools. This change replaces the MsgFmt_*
with a stub. This also affects the Windows version.
Oliver Kurth [Fri, 5 Jan 2018 22:47:15 +0000 (14:47 -0800)]
Fix the SSL/AsyncSocket "SSL_shutdown:shutdown while in init" problem
QE regression tests have caught a bug in the bora SSL/AsyncSocket
layer. A normal SSL connection could be abnormally terminated by some
other random connections.
Seems a common bug of the SSL usage according to the link below.
VMware is not the first one to hit it. :-)
https://marc.info/?l=openssl-users&w=4&r=1&s=shutdown+while+in+init&q=b
The cause is that the SSL error queue was not cleared before
calling the SSL IO functions like SSL_write,read,connect,accept.
Refer to the man page of SSL_get_error, Paragraph 2 of the Description.
Fixed the problem by adding addtional call to clear the error queue.
Found another problem that the system error is not preserved between
where it is set after the SSL IO call and the use of it to determine
whether to retry the SSL IO. This is probably due to tools has its
own logging which does not preserve the system error number.
Fixed the logging.
Oliver Kurth [Fri, 5 Jan 2018 22:47:15 +0000 (14:47 -0800)]
vm_basic_types.h: use stdint.h a little more.
Now that enough of the builds are C++11, let's make the common case
use the <stdint.h> header to define the intNN types directly
from language-standard intNN_t types, and treat pre-C99/C++98
code as the special case.
This also provides some clarity about the last __STRICT_ANSI__
macros in this file. One was related to usage of 'long long' in
strict c90 mode and has been replaced with a comment indicating that
64-bit-variable compiler extensions are mandatory (strict c90 mode is
not allowed via the headers). The other related to X11 headers; those
headers have been examined to understand the workarounds needed and
the exact scenario(s) that are problematic have been commented (turns
out FreeBSD had nothing to do with the problem).
Finally, all the Bool-related definitions have been moved and merged
to a single location NOT at the top of the file.
Net effects of this change:
- non-linux C++11 (so Windows+Mac) now uses stdint.h
- exact set of macros involved in declaring Bool is reduced
- compiling with c90 mode really will break now (use gnu90 instead).
Oliver Kurth [Fri, 5 Jan 2018 22:47:15 +0000 (14:47 -0800)]
Consume vmx headear files in bora tree instead of gosc's own copy
1. Consuming header files from bora/vmx instead of gosc/vmx
2. Deprecated "gosc/vmx/public/toolsdDeployPkg.h",
use "bora/guestABI/include/vmware/guestrpc/deploypkg.h" instead.
Combined macro definition to the new header file and modified
reference accordingly.
3. Modified makefile for open-vm-tools to consume new header file,
removed old header file staging in open-vm-tools.stage
Oliver Kurth [Fri, 5 Jan 2018 22:47:15 +0000 (14:47 -0800)]
Remove some __STRICT_ANSI__ guards in vm_basic_types.h
Some time in the distant past, these guards were needed to
work around... something. (Probably, it was that 'long long'
is not a valid type in strict c90 mode). Note that we don't
use c90 mode, we only use gnu90 or c99.
This ends up being relevant because for C++ we are indeed
using -std=c++11 (which implies __STRICT_ANSI__). The Linux/C++
section of this file thus had duplicate definitions (which I am
now removing) to work around the gap.
Quick cheat sheet for -std= values:
- c90 := __STRICT_ANSI__, no long long type
- gnu90 := c90 + gcc extensions, has long long type
- c99 := __STRICT_ANSI__, has long long type (defined in c99)
- c++11 := __STRICT_ANSI__, has long long type (defined in C++11)
Oliver Kurth [Fri, 5 Jan 2018 22:47:15 +0000 (14:47 -0800)]
open-vm-tools: fix finding C++ compiler for cross-compiling
Patch contributed by Andrew Stormont (andy-js) on github:
https://github.com/vmware/open-vm-tools/pull/206 and
https://github.com/vmware/open-vm-tools/issues/92.
Oliver Kurth [Fri, 5 Jan 2018 22:47:14 +0000 (14:47 -0800)]
Allow copying of object policy within the same container
ObjLib_CloneExtParams is currently not allowing copying of policy from
parent to child/clone object on VSAN. This is because the copy policy
check is based on unique filesystem ID, which will be different for
parent and child on VSAN because they will mostly be created on same
container but different namespace. This change uses VCFS root instead
of namespace UUID to make the comparison on VSAN.
Bonus fix: File_FullPath is now fixed to work for any combination of
ancestor path being present. Currently it only works if either the
given path exists, or when only the last component of the path does
not exist. And since this fix relies on finding the VCFS root of both
parent and child (parent is present but child is not),
ObjLibPathToVCFSRoot has been modified to rely on File_FullPath in
addition to Util_GetCanonicalPath if the path does not exist.