Oliver Kurth [Mon, 20 Aug 2018 19:48:07 +0000 (12:48 -0700)]
Changes to common source files; not directly applicable to open-vm-tools
Add support for CRX pod and sys (version 1) VMs
These are special Linux 4 VMs; the CRX pod VMs are wrapped around
Kubernetes. Here we provide the basic VMX recognition and support
mechanisms. Later changes will add the support of the CRX pod VMs
to VIM/VMODL... and other pieces.
Oliver Kurth [Mon, 20 Aug 2018 19:48:07 +0000 (12:48 -0700)]
Properly free the memory when RpcChannel_Send() fails.
At few places in the code, when RpcChannel_Send() function fails,
the result (fourth argument to the function) is not freed which might
result in a memory leak.
Addressed few references by adding 'RpcChannel_Free(...)' calls
in the necessary error code paths.
For toolbox-cmd application, added a new function ToolsCmd_FreeRPC
which internally calls RpcChannel_Free function to free the memory
allocated from ToolsCmd_SendRPC calls. Modified toolboxcmd-shrink.c
to use the new function to free the memory.
Oliver Kurth [Mon, 20 Aug 2018 19:48:05 +0000 (12:48 -0700)]
Add the notification to toolsd about the guest log level change.
Consolidated the VIGOR APIs of guestLogEnabled and guestLogLevel, since
it is easier for the customers to use just one API to set both. Use
the "disable" enum value to disable the guest logging instead of
using a separate field and VIGOR API.
Now sending a new tools option to the toolsd whenever the guestLogLevel
changes.
These code changes are based on following two principles:
1. No functional impact/change on DnD & Copy Paste feature for WS/Fusion.
2. The DnD base code is ready for Horizon View DnD feature target for
an upcoming release.
Summary for this patch:
1. The dependency refactor to add a new folder dndGuestBase (lib\dndGuestBase)
to extract the common code shared by WS/FS and View.
2. Add two sub folders to dndGuestBase (vm-inc and crt-inc) to contain
the WF/FS or view specific header files. (for example,
vm-inc/vmGuestDnDSrc.hh, crt-inc/crtGuestDnDSrc.hh....)
3. The header files start with 'crt' will not be used by WS/FS, they are
added only for specifying the new folder structure.
4. Move WS/FS specific dndGuest/dndcp codes to WS/FS specific derived
classes like VMGuestDnDCPMgr, VMGuestDnDMgr, VMCopyPasteDnDWrapper and so on.
5. Also have created some Horizon View specific codes on mkvchanserver in
local environment to verify most of interfaces in the base classes are
ready for Horizon View side DnD development.
Oliver Kurth [Fri, 27 Jul 2018 18:46:21 +0000 (11:46 -0700)]
Yet More SnowMotion Logging
Prior logging indicates an issue when reading back from disk, so
tweak the logging to report the count# (since SuperFgets doesn't log
null terminators) of bytes and add a log to Dictionary_WriteFile to log
the last 100 bytes of the buffer.
Oliver Kurth [Fri, 27 Jul 2018 18:46:21 +0000 (11:46 -0700)]
Changes to common header files; not applicable to open-vm-tools
GOS: Add support for Windows Server 2019
Add support for the upcoming Windows Server 2019. With this change it
is present but does not show up in a public menu. Making it appear in
a customer menu is something the hosted UI group does... when they are
ready.
Oliver Kurth [Fri, 27 Jul 2018 18:46:20 +0000 (11:46 -0700)]
[tools-plugin] Potential solution for reported desktopEvent crash
On several distros like RHEL, CentOS and Fedora, plugin desktopEvents.so
crashes have been reported. However, neither development or QE can
reproduce this issue in local environments.
The XFetchName document states that it may generate BadWindow error. That
means that the value for a Window argument does not name a defined Window.
X FAQ also suggests handling badwindow error after finding it. Since
the window does not exist when XFetchName is run on it, the name is not
needed. Suppress this error to avoid a crash.
After grabbing the X server, use XSetErrorHandler to temporarily define
a local error handler to intercept and cleanly handle any BadWindow
errors. XSetErrorHandler returns the current error handler, so it is
straightforward to reinstate GDK's original handler.
Oliver Kurth [Fri, 27 Jul 2018 18:46:20 +0000 (11:46 -0700)]
Changes to common source files; not directly applicable to open-vm-tools
MXUser: Lock tracking causes panic
MXUser locks require a unique serial number so the lock stats code
can proprly differentiate between each lock. We can't depend on the
name to be unique as some locks are created and deleted many times,
reusing their names.
The serial number is also used to avoid ASLR attacks... we can't use
the address of a lock... and even if we did, it's possible for that
address to be reused... MXUser locks are dynamically allocated.
The lock tracking code tracks the number of locks and this is now
causing an issue. Way back when it was thought that seeing what
was deemed a huge number of locks indicated a problem... but today
we think those limits are getting quite small.
Enlarge the serial number space to 64-bits. If we constantly create 1M
locks per second it would take over 500000 years before we would have
a problem like this again.
Oliver Kurth [Fri, 27 Jul 2018 18:46:19 +0000 (11:46 -0700)]
open-vm-tools: use AC_CHECK_TOOL for pkg-config
AC_CHECK_TOOL honors the --host setting to configure, and
searches for tools with the cross compile prefix thus
allowing for cross compile specific tools.
Oliver Kurth [Fri, 27 Jul 2018 18:46:19 +0000 (11:46 -0700)]
Fix a bug where the clipboard content on the host gets loaded to tmp on
the Linux guest with a right click on the guest
Root Cause: Dndcp plugin creates a sub thread to monitor if there is another
application access to the specific file. The root cause for
this bug is the main thread doesn't update its field before
wakeup of the sub thread, this cause the sub thread get a wrong
value.
Solution: Main thread should update the field before waking up the sub thread.
Oliver Kurth [Fri, 6 Jul 2018 21:31:55 +0000 (14:31 -0700)]
[tools-plugin] Potential solution for reported desktopEvent crash
On several distros like RHEL, CentOS and Fedora, plugin desktopEvents.so
crashes have been reported. However, neither development or QE can
reproduce this issue in local environments.
The XFetchName document states that it may generate BadWindow error. That
means that the value for a Window argument does not name a defined Window.
X FAQ also suggests handling badwindow error after finding it. Since
the window does not exist when XFetchName is run on it, the name is not
needed. Suppress this error to avoid a crash.
After grabbing the X server, use XSetErrorHandler to temporarily define
a local error handler to intercept and cleanly handle any BadWindow
errors. XSetErrorHandler returns the current error handler, so it is
straightforward to reinstate GDK's original handler.
Oliver Kurth [Wed, 20 Jun 2018 00:07:51 +0000 (17:07 -0700)]
Use "/var/run" or "/run" instead of "/tmp" in Linux guest for imc package copy
1. check if /var/run is a directory in VM
2. if Yes, use /var/run/XXXXXX
3. check if /run is a directory in VM
4. if Yes, use /run/XXXXXX
5. if both No, use /tmp/XXXXXX as before
Oliver Kurth [Wed, 20 Jun 2018 00:07:51 +0000 (17:07 -0700)]
FreeBSD: clang compiler related changes to configure.ac
On FreeBSD, the unwind.h header is available in the libunwind
package (/usr/ports/devel/libunwind) which may or may not be installed
on a system. The libunwind functions to determine the call-chain in a
program are defined only if " __GNU_SOURCE" is defined to enable "all"
GCC extensions. Avoid the unwind.h header if seen on FreeBSD.
The "clang" compiler will issue warnings if the address of a member
of a packed structure is taken. Since warnings are errors with -Wall,
add --Wno-address-of-packed-member to CFLAGS when compiling with
"clang".
Oliver Kurth [Wed, 20 Jun 2018 00:07:50 +0000 (17:07 -0700)]
Build open-vm-tools with xmlsec1 by default.
Build open-vm-tools with xmlsec1 by default, rather than with
xml-security-c as is done currently. This requires modifications
to configure.ac to change the default for use_xmlsec1, plus
modifications to bora-vmsoft/install/Source/tools-pkg.make to
initialize flags for xmlsec1 and xml2 now needed by the OVT build
that is done during tools builds.
Another change that surfaced during this was that the symbol that
configure checks for the xmlsec library was wrong. It should be
xmlSecCheckVersionExt rather than xmlSecCheckVersion. The latter
is a header-defined macro but not a library symbol.
Oliver Kurth [Tue, 19 Jun 2018 18:07:46 +0000 (11:07 -0700)]
open-vm-tools: use AC_CHECK_TOOL for pkg-config
AC_CHECK_TOOL honors the --host setting to configure, and searches
for tools with the cross compile prefix thus allowing for cross
compile specific tools.
Oliver Kurth [Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)]
Clipboard content on the host gets loaded to tmp on Linux guest with a right click on Guest
Root Cause:
Dndcp plugin creates a sub thread to monitor if there is other application
access the specific file. The root cause for this bug is the main thread
doesn't update its field before wakeup the sub thread, this cause the sub
thread get a wrong value.
Solution:
Main thread should update the field before wakeup the sub thread.
Oliver Kurth [Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)]
Use "/var/run" or "/run" instead of "/tmp" in Linux guest for imc package copy
1. check if /var/run is a directory in VM
2. if Yes, use /var/run/XXXXXX
3. check if /run is a directory in VM
4. if Yes, use /run/XXXXXX
5. if both No, use /tmp/XXXXXX as before
Oliver Kurth [Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)]
Build open-vm-tools with xmlsec1 by default.
Build open-vm-tools with xmlsec1 by default, rather than with
xml-security-c as is done currently. This requires modifications
to configure.ac to change the default for use_xmlsec1, plus
modifications to bora-vmsoft/install/Source/tools-pkg.make to
initialize flags for xmlsec1 and xml2 now needed by the OVT build
that is done during tools builds.
Another change that surfaced during this was that the symbol that
configure checks for the xmlsec library was wrong. It should be
xmlSecCheckVersionExt rather than xmlSecCheckVersion. The latter
is a header-defined macro but not a library symbol.
Oliver Kurth [Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)]
[Wayland Copy & Paste] Part1: Add notification mechanism to the VMBlock module
This patch is part of the new feature for Workstation 15: [P0] Wayland support
in Linux guest - Copy & Paste.
In the implementation of current VMTools, there is a restriction, in the first
second after grab into the guest, the CopyPasteUIX11::LocalGetFileRequestCB,
which is a callback from a file paste request from another guest application
and begins copying the files from host to guest and return the file list,
will return none directly.
The Wayland file explorer will request the content in the clipboard after the
user clicks on the file explorer, and the request will get nothing since the
restriction in the VMTools, so the following ‘Paste’ operation will fail.
Solution:
This solution is only used for the Linux guest with Wayland. The behavior
for Linux guest with X11 will not change.
The restriction, the CopyPasteUIX11::LocalGetFileRequestCB returns directly
in the first second after grab into the guest, will be removed.
And, the notification mechanism will be added into the VM block file system.
This mechanism is similar with the inotify module.
Take the VMBlock Fuse File System as an example, currently, the mount point contains below contents:
* /blockdir/
* /dev
/blockdir/ contains the symlinks to the contents of the target directory.
/dev is the control file for VMBlock Fuse File System.
In this new solution, a new folder /notifydir/ will be added, each file in this folder is a special file, read from this file will be blocked until any other process read from the corresponding file in target directory or the block on the target directory is removed.
This patch only focus on the notification mechanism.
Oliver Kurth [Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)]
FreeBSD: clang compiler related changes to configure.ac
On FreeBSD, the unwind.h header is available in the libunwind
package (/usr/ports/devel/libunwind) which may or may not be installed
on a system. The libunwind functions to determine the call-chain in a
program are defined only if " __GNU_SOURCE" is defined to enable "all"
GCC extensions. Avoid the unwind.h header if seen on FreeBSD.
The "clang" compiler will issue warnings if the address of a member
of a packed structure is taken. Since warnings are errors with -Wall,
add --Wno-address-of-packed-member to CFLAGS when compiling with
"clang".
Oliver Kurth [Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)]
open-vm-tools: build with tirpc
Newer distros (Fedora, OpenSuSE Tumblweed) no longer ship rpcgen with glibc,
so we need to build with libtirpc (see
https://bugzilla.redhat.com/show_bug.cgi?id=1531540 and
https://bugzilla.suse.com/show_bug.cgi?id=1089181).
With this change, configure will check for the presence of libtirpc and
if found, sets flags to build with it. configure will also exit with an
error if rpcgen is not found.
Oliver Kurth [Tue, 19 Jun 2018 18:07:44 +0000 (11:07 -0700)]
Log full version of Tools in vmware.log.
Currently, only the Tools build number is logged in vmware.log.
It will be very handy to have the full version logged in
there and avoid the need to manually lookup the build.
Oliver Kurth [Tue, 19 Jun 2018 18:07:44 +0000 (11:07 -0700)]
Add two switches for max IPv4/6 routes to gather
Gathering nic info in a Linux guest OS which is configured with large
number(60000+) of ipv6 routes could result in vmtoolsd process taking a
long time and rock solid 100% CPU of a core. Though tools only exports
at most NICINFO_MAX_ROUTES(100) routes, it tries to read all the contents
of /proc/net/ipv6_route which costs too much time because:
1. IPv6 route table is not efficient natively compared to ipv4 due to
its implementation.
2. The g_io library can aggravate the performance.
On the other hand, when gathering routes, IPv4 comes first, and IPv6 second.
And the routes reported to VMX has an overall limitation of serializing
(NICINFO_MAX_ROUTES). If there's more than NICINFO_MAX_ROUTES IPv4 routes
in system, no IPv6 will get reported.
Added two switches "max-ipv4-routes" and "max-ipv6-routes"
(NICINFO_MAX_ROUTES by default) in tools.conf and let SlashProcNet_GetRoute*()
only read the first max ipv4/6 routes lines of /proc/net/[ipv6_]route to avoid
performance problem. Users can disable ipv4/ipv6 routes gathering
separately if they want ipv6 or ipv4 only.
Oliver Kurth [Tue, 19 Jun 2018 18:07:44 +0000 (11:07 -0700)]
Not checking symbols when building open-vm-tools
Using a hard-coded mangled name is not a good idea because C++ does not
have any standard for name mangling. Remove these mangled names introduced
in an earlier fix.