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 [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, 5 Jun 2018 22:47:39 +0000 (15:47 -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, 5 Jun 2018 22:47:38 +0000 (15:47 -0700)]
Add Safe version of DynBuf_Enlarge
This change adds the "safe" variant of the enlarge interface. Similar to
DynBuf_SafeAppend, this panics when the buffer enlargement fails due to
memory allocation failures.
Oliver Kurth [Tue, 5 Jun 2018 22:47:38 +0000 (15:47 -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, 5 Jun 2018 22:47:37 +0000 (15:47 -0700)]
Change the balloon driver internals to 64-bits.
As a first step towards making the driver being able to balloon 16TB+,
let's change all the internals to use 64-bits values for the counters.
Initially, I wanted to only touch the windows driver, as this is the one
that we really care about, but since some code and datastructure are
shared, I had to modify pretty much all drivers.
The next step will be to change the drivers capabilities by adding
BALLOON_64_BIT_TARGET.
Oliver Kurth [Tue, 5 Jun 2018 22:47:37 +0000 (15:47 -0700)]
Bump invalid PPN to 2^52 - 1
We are ready to bump INVALID_PPN value. Let us set it
to 2^52 - 1. This is more than enough to get over 4PB vRAM,
that requires 40-bit PPNs.
Another option was to set it to (uint64)-1, like the current value
of INVALID_PPN64, but it seems like there is no good reason
to do it. There are a few instances where INVALID_PPN is
treated as a regular PPN, e.g. we may convert it to PA and back.
2^52 - 1 will allow us to preserve that natural relationship
between invalid PPN and invalid PA.
All INVALID_PPN64 will have to be converted to INVALID_PPN
in follow up changes.
Oliver Kurth [Tue, 5 Jun 2018 22:47:36 +0000 (15:47 -0700)]
Fix locale issues for vgauth on Linux
setlocale() returns nothing unless we earlier force it
to be empty.
Change the default msgCatalog location on Linux so
the catalogs can be found without config changes in the normal
install area.
When doing catalog lookup, first chop off the charset
suffix. Otherwise we first look for 'zh_CN.UTF-8', then
fall back to just 'zh' if that fails. We support zh_TW and zh_CN,
but not a 'zh'.
Also fix things for NeoKylin, which appears to use LANG
but not setlocale().
Oliver Kurth [Tue, 5 Jun 2018 22:47:35 +0000 (15:47 -0700)]
[Wayland DnD] Part3: Update the Drag Detection Window and Use UInput in DnDUIX11
Two changes in this patch:
1. Changes the class DragDetWnd to template class.
Currently the DragDetWnd inherits from Gtk::Invisible, but Gtk::Invisible
doesn't work for Wayland, it seems this is a bug for Wayland and maybe it
will be fixed sometime.
So, changes the DragDetWnd to template class, and it will inherit from
Gtk::Invisible for X11 and inherit from Gtk::Window for Wayland.
2. Uses UInput to simulate mouse motion in class DuDUIX11.
This patch is part of the new feature 'Wayland support in Linux guest'.
Oliver Kurth [Tue, 5 Jun 2018 22:47:35 +0000 (15:47 -0700)]
vm_basic_types.h: use system headers for uint64_t, uintptr_t, size_t
Extensive rewrite. Basically standardizes on using stdint.h (C99)
and sys/types.h (POSIX) to define interesting types, with several
non-trivial caveats:
- stdint.h is not available on older Windows compilers. For now,
emulate with crtdefs.h + manual definitions.
- Linux kernel does not provide stdint.h (gcc-4.5+ does and it's
incompatible), and sys/types.h won't work at all.
However, linux/types.h gives everything we need.
- Linux kernel defines uint64_t as 'long long' (and uintptr_t as
'long' - yes, really), in contrast to Linux userlevel which defines
uint64_t as 'long'. Send Linux kernel down a different FMT64 path
so we don't get "%llx" / "%lx" mismatches.
- VMM and VMKernel don't provide sys/types.h (except VMK's FreeBSD
modules). Directly provide definitions here.
Net effect of this change is removal of two blocks of code that
provide our own definitions of uintptr_t/intptr_t/size_t/ssize_t.
Also pruned a few now-unneeded stdint.h and sys/types.h includes as well.
Curious observers will inquire why not get size_t from C99 standard
header stddef.h. Turns out that header is EXCEPTIONALLY hard to include,
which is why I'm using sys/types.h in most places. Actually using
stddef.h is left for a later change.
Oliver Kurth [Tue, 5 Jun 2018 22:47:33 +0000 (15:47 -0700)]
[tools] 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.
Way back when the tracking of the top users of an MXUser lock was added
to the stats. It was never used, it's not reported by kstats.prl and
the code make it possible to break ASLR. Remove the code.
Oliver Kurth [Tue, 5 Jun 2018 22:45:07 +0000 (15:45 -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, 5 Jun 2018 22:45:06 +0000 (15:45 -0700)]
Hostinfo_GetCpuid Cleanups
This change includes several cleanups in Hostinfo_GetCpuid. The CPUIDSummary
type is unnecessary, the function really only cares about levels 0 and 1.
Also removed a hardcoded mask and shift in favor of a CPUID_GET and fixed
some formatting issues.
Oliver Kurth [Tue, 5 Jun 2018 22:45:06 +0000 (15:45 -0700)]
locks: Increase buffer size in MXUserHistoDump
It was noticed that the size of one of the char arrays in MXUserHistoDump
is not large enough given the format string. This change bumps the
size to accommodate (plus slack).
Oliver Kurth [Tue, 5 Jun 2018 22:45:05 +0000 (15:45 -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, 5 Jun 2018 22:45:04 +0000 (15:45 -0700)]
retire PPN, TPPN, PageNum, PageCnt types
This change retires 32-bit PPN, TPPN, PageNum, PageCnt types and
introduces temporary PPNTMP type for tools (graphics, pvscsi, balloon),
so that driver owners can work on PPN64 conversion at their own
pace and can easily identify places that require attention.
Oliver Kurth [Tue, 5 Jun 2018 22:45:03 +0000 (15:45 -0700)]
Hgfs Server Plugin: only handle the shared folders client in hosted products
Only initialize the Shared Folders client redirector in hosted product
environments.
Details: Check if the tools system service started in a non-hosted product
and if so do not start the shared folders client redirector.
Check if the tools user service started in a non-hosted product product and if
so then skip reconnecting any Shared Folders mapped drives.