]> git.ipfire.org Git - thirdparty/open-vm-tools.git/log
thirdparty/open-vm-tools.git
8 years agoReport version data via guestinfo vars
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Report version data via guestinfo vars

Set up some guestVars to report Tools version info
(version, build number, etc).

8 years agoRename VThread_IsXxx() to VMX_IsXxxThread()
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Rename VThread_IsXxx() to VMX_IsXxxThread()

Unrelated to open-vm-tools.

8 years agoAsyncSocket: Fix lock rank violation introduced by WaitForReadMultiple
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
AsyncSocket: Fix lock rank violation introduced by WaitForReadMultiple

There's a lock call that should be an unlock.

8 years agoARM: Better decode CPU Model Name
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
ARM: Better decode CPU Model Name

Instead of always returning "ARM64", the CPU model name will now be the
CPU vendor followed by the core name and revisio, eg.

ARM Limited Cortex-A57 r1p2

hostinfoPosix arm64 hack to always return "armv8 unknown" is removed,
and will forward the CPU Model Name.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agofile: Report correct error message when file is locked.
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
file: Report correct error message when file is locked.

8 years agoCheck for gdk_pixbuf_xlib-2.0 in configure script
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Check for gdk_pixbuf_xlib-2.0 in configure script

gdk_pixbuf_xlib-2.0 is no longer part of gdk-pixbuf2 in newer
distributions (for example Fedora 26), so it's no longer pulled
in as a dependency from the gtk devel packages. Therefore we
need an extra check for it.

8 years agoClean up overflow NIC issues
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Clean up overflow NIC issues

If we hit the max number of IPs, we just keep going
and try to add the next one.  This makes for extra work
and produces lots of log spew.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoMKS Thread: make VThreadID dynamic
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
MKS Thread: make VThreadID dynamic

Unrelated to open-vm-tools.

8 years agoSmarter handling of large numbers of disk mounts
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Smarter handling of large numbers of disk mounts

Instead of just giving up if we find more than 255
mounts, expose what we can.

8 years agoLog DRM version in the debug message.
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Log DRM version in the debug message.

The additional version in the message proved very useful
while debugging resolutionKMS functionality.

8 years agoRemove ufs code
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
Remove ufs code

There is currently no use case for it.

8 years agomodules/shared/vmxnet/vmxnet3_defs.h:
Oliver Kurth [Fri, 15 Sep 2017 18:23:38 +0000 (11:23 -0700)] 
modules/shared/vmxnet/vmxnet3_defs.h:
  - Code restructure of some MACROS.

8 years agoDowngrading 10.2.0 Tools to 10.0.9 fails to start CAF.
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Downgrading 10.2.0 Tools to 10.0.9 fails to start CAF.

Create the cafenv.config file required by 10.0.9 Tools
from cafenv.appconfig of 10.2.0 Tools.

Clean up CAF files after Tools uninstall.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoAdd new AsyncSocket API to wait on multiple sockets at once
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Add new AsyncSocket API to wait on multiple sockets at once

Currently, there is no way to poll/select on multiple sockets through
the asyncsocket library. VRDMA is encountering a use case for such
functionality, so add such an API to asyncsocket.  It is only defined
for AsyncTCPSocket, and is mostly just a wrapper around AsyncTCPSocketPoll.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoAvoid name strings other than vmusr/vmsvc in vmtoolsd command line.
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Avoid name strings other than vmusr/vmsvc in vmtoolsd command line.

Add name checking when parsing command line.

8 years agoChanges to common header files; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Changes to common header files; not applicable to open-vm-tools.

8 years agoChange defined(linux) to defined(__linux__) in open-vm-tools files.
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Change defined(linux) to defined(__linux__) in open-vm-tools files.

Reported by open source developer on GitHub,
see github.com/vmware/open-vm-tools/pull/81.

8 years agoStop using deprecated glib APIs in vgauth
Oliver Kurth [Fri, 15 Sep 2017 18:23:37 +0000 (11:23 -0700)] 
Stop using deprecated glib APIs in vgauth

Replace some static mutexes with the modern versions.

8 years agoFix HostinfoGetCmdOutput to return NULL on failure
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Fix HostinfoGetCmdOutput to return NULL on failure

HostinfoGetCmdOutput unconditionally calls DynBuf_DetachString
along its success path.  DynBuf_DetachString never returns NULL,
so that broke callers expecting a NULL return value if the command
had no output (which can happen if HostinfoGetCmdOutput attempts to
run a non-existent executable; note that this does not trigger any
of the failure paths).

Restore the old code that checked if the DynBuf is non-empty
before retrieving its contents.

Bonus:
* Fix incorrect documentation to Posix_Popen.
* Adjust the StdIO_ReadNextLine documentation to clarify its behavior.

8 years agoChanges to common source files; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Changes to common source files; not applicable to open-vm-tools.

services/plugins/dndcp/stringxx/string.cc:
services/plugins/dndcp/stringxx/string.hh:
 - Change  utf::string::toUpper() and related functions to  default the
   locale argument to a NULL pointer.

8 years agoUpdate vm_tools_version.h with Tools 10.1.x update and patch versions.
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Update vm_tools_version.h with Tools 10.1.x update and patch versions.

Updating the VMware Tools version information for the known
vmtools 10.1.x updates and patches.

10.1.6  - vmtools_prod-cpd-ep3: CLN 4984516
10.1.10 - vmtools-prod-cpd: CLN 5016060

8 years agoCheck alignment in Atomic_* functions for the VMKernel
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Check alignment in Atomic_* functions for the VMKernel

Unrelated to open-vm-tools.

8 years agoFix i18n symbol violations
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Fix i18n symbol violations

Fix some of the illegal symbols that are flagged.  Also changed the
wrapper for unsetenv to return an int to match the glibc-2.2.2 and
later version.  Tools build for FreeBSD appears to be using an older
libc so it always reports success in that case.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoRevert the previous commit.
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Revert the previous commit.

8 years agoCheck alignment in Atomic_* functions for the VMKernel
Oliver Kurth [Fri, 15 Sep 2017 18:23:36 +0000 (11:23 -0700)] 
Check alignment in Atomic_* functions for the VMKernel

Unrelated to open-vm-tools.

8 years agoRe-enable ASAN for DynBuf_Append()
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Re-enable ASAN for DynBuf_Append()

The problem is incorrectly instrumented callers.

8 years agoCommon header file change: not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Common header file change: not applicable to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoNew common header file: lib/include/product.h.
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
New common header file: lib/include/product.h.
Move public product types enum from lib/include/productState.h to product.h
Common header file change; not applicable to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoRevert previous commit.
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Revert previous commit.

8 years agoInterpose dlopen() to only allow root-owned library
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Interpose dlopen() to only allow root-owned library

Only allow dlopen() on library that meets the following:
- the library file is root-owened
- the directory is root-owned, and not others-writable.

8 years agoRestrict panic's int3 assembly to x86(_64).
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Restrict panic's int3 assembly to x86(_64).

Panic could also be used for iOS.

8 years agoDelete unused COMPILER_FORCED_LOAD_AND_MEM_BARRIER
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Delete unused COMPILER_FORCED_LOAD_AND_MEM_BARRIER

Delete the macro definition.

8 years agoMemory barriers: LD_LD_MEM_BARRIER -> SMP_R_BARRIER_R
Oliver Kurth [Fri, 15 Sep 2017 18:23:35 +0000 (11:23 -0700)] 
Memory barriers: LD_LD_MEM_BARRIER -> SMP_R_BARRIER_R

Delete the now unused, old macro name.

8 years agoMemory barriers: LD_ST_MEM_BARRIER -> SMP_R_BARRIER_W
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: LD_ST_MEM_BARRIER -> SMP_R_BARRIER_W

Delete the now unused, old macro name.

8 years agoMemory barriers: LD_LDST_MEM_BARRIER -> SMP_R_BARRIER_RW
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: LD_LDST_MEM_BARRIER -> SMP_R_BARRIER_RW

Delete the now unused, old macro name.

8 years agoMemory barriers: ST_LD_MEM_BARRIER -> SMP_W_BARRIER_R
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: ST_LD_MEM_BARRIER -> SMP_W_BARRIER_R

Remove the now unused old macro name.

8 years agoMemory barriers: ST_ST_MEM_BARRIER -> SMP_W_BARRIER_W
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: ST_ST_MEM_BARRIER -> SMP_W_BARRIER_W

Remove the now unused old name.

8 years agoMemory barriers: ST_LDST_MEM_BARRIER -> SMP_W_BARRIER_RW
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: ST_LDST_MEM_BARRIER -> SMP_W_BARRIER_RW

Delete the now unused macro.

8 years agoMemory barriers: LDST_LD_MEM_BARRIER -> SMP_RW_BARRIER_R
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: LDST_LD_MEM_BARRIER -> SMP_RW_BARRIER_R

Deleted the old macro name.

8 years agoMemory barriers: LDST_ST_MEM_BARRIER -> SMP_RW_BARRIER_W
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: LDST_ST_MEM_BARRIER -> SMP_RW_BARRIER_W

Delete the now unused old macro.

8 years agoMemory barriers: LDST_LDST_MEM_BARRIER -> SMP_RW_BARRIER_RW
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers: LDST_LDST_MEM_BARRIER -> SMP_RW_BARRIER_RW

Delete the old macro that is now unused.

8 years agoMemory barriers
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Memory barriers

Unrelated to open-vm-tools.

Previously added new barriers for arm64 and x86_common, but
forgot to handle arm32. This change does that, and fixes a
mangled comment.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:34 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoRemove NOT_TESTED() from EINTR handling in lib/file
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Remove NOT_TESTED() from EINTR handling in lib/file

When FileIO_Read() & friends receive EINTR, they log NOT_TESTED, and
retry read.  It seems innocent - until you provide your own function
to handle logging.

Now imagine that you create bidirectional communication protocol,
and run it over the pipe.  And you do logging over this very same
pipe.  Application is waiting for message, so it invoked
FileIO_Read(), and is blocked on read().  Now you attach strace
to the process.  That will interrupt pending read() with EINTR
and log NOT_TESTED().  This logging performs FileIO_Write() on
this very same pipe, and then performs FileIO_Read() to retrieve
status of logging request.

If it receives status of logging request, all is good.  Code
returns from logging, and reexecutes read(), waiting for
request from server.

But if logging function receives anything else (f.e. other side
sends request at same time strace was attached), it gets queued
into internal data structures of the app for processing once
code returns to main application loop.

Problem is that FileIO_Read() will reenter read() without
returning to the caller.  And that read() will block forever:
other end already send request that is now pending in the
request list, and so won't send anything until it sees
we processed that pending request.  Hang.

There are two possible fixes:

1. Return EINTR from FileIO_Read(), or

2. Do not do any logging from FileIO_Read()

Approach #2 is much easier, as API semantic does not change,
and currently it is broken.  So there is no need for NOT_TESTED()
anymore...

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoIn DnD transport V3 check packet and payload size to prevent OOB read
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
In DnD transport V3 check packet and payload size  to prevent OOB read
or write.

8 years agoBetter Panic_BreakOnPanic implementation on macOS.
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Better Panic_BreakOnPanic implementation on macOS.

There's actually a documented way to check whether a process is being
debugged on macOS.  This change updates panic lib to use it.

8 years agoHgfs Server: Very minor clean up of server callback table
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Hgfs Server: Very minor clean up of server callback table

Another very minor clean up for final part for making the Hgfs server
callback table constant.

8 years agolib/include/vm_assert.h:
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
lib/include/vm_assert.h:
  - Remove unused ASSERT_* macros.

modules/shared/vmxnet/vmnet_def.h:
  - Fix definition mismatch of VMNET_CAP_RX_LRO and VMK_PORT_CLIENT_CAP_HW_DCB.

8 years agoFix tools build
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Fix tools build

dynbuf.c and sigPosix.c are consumed by tools.

8 years agoChanges for userspace ASAN
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Changes for userspace ASAN

This is mostly disabling ASAN for some functions and adjusting overheads.
Code, touching the guest memory, currently cannot be instrumented.

8 years agoMake CAF consume the same version of GLIB (and dependencies) used by Tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:33 +0000 (11:23 -0700)] 
Make CAF consume the same version of GLIB (and dependencies) used by Tools.

Summary of changes-

1. Linux: Make the following libraries point to their Tools
   counterparts by updating the LD_LIBRARY path in CAF makefile:
   -libglib-2.0.so.0
   -libiconv.so.2
   -libpcre.so.1
   -libz.so.1
   -libffi.so.6
   -libgthread-2.0.so.0
   -libstdc++.so.6
   -libgcc_s.so.1

2. Linux: Add a new environmental variable INSTALL_MODE = tools/standalone
   in makefile, setting it to "tools" by default, to handle copying of the
   required GLIB (and dependencies) for CAF "standalone" installation.

3. Linux: Update setupCafConfig function to add the INSTALL_MODE property
   if not present already to handle build2build upgrade case.

8 years agoAdd constants for macOS os major versions.
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Add constants for macOS os major versions.

MacOS versions can get a bit confusing because there are two parallel
versioning schemes. There is the marketing version (e.g. 10.6, 10.7.5, etc.)
which is what everybody uses when discussing the OS but is very hard to get
at via code, and there is the kernel version (e.g. 10.0.0, 11.4.2) which
is what is returned by POSIX syscalls like uname. The confusion sets in
because in comments we tend to use the marketing version, but then the
code actually checks for the kernel version.

This change adds constants for the marketing version for comparisons with
HostInfo_OSVersion(0) (the major version), which makes checking for
10.6 vs 10.7 vs 10.8 etc. much more readable.

8 years agoAdd vgauth smoketest
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Add vgauth smoketest

Provide the vgauth smoketest so open-vm-tools builders
can validate VGAUthservice.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoRemove BDOOR_CMD_HOSTCOPY backdoor handler.
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Remove BDOOR_CMD_HOSTCOPY backdoor handler.

The BDOOR_CMD_HOSTCOPY command has been under VMX86_DEVEL and is no
longer used.  Remove it.

8 years agoFix building without ICU
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Fix building without ICU

Building vgauth failed when building without ICU (with the
--without-icu option). This was caused by not using cxx
link options which are needed by xml-security, but only
enabled when using ICU.

Also fix the warning "invalid suffix on literal;".

8 years agoTools Hgfs Transport: Make the server callback table constant
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Tools Hgfs Transport: Make the server callback table constant

Simple change to make the Hgfs tools transport use the server
table of callbacks as a constant.

8 years agoCommon header file change: not applicable to oprn-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Common header file change: not applicable to oprn-vm-tools.

8 years agoFix tools build
Oliver Kurth [Fri, 15 Sep 2017 18:23:32 +0000 (11:23 -0700)] 
Fix tools build

For open-vm-tools there is code that strips off the
"VMware Confidential" part of the msgfmt.c header. When
the copyright years were updated in msgfmt.c, it broke
the pattern matcher.

8 years agoReplace Atomic_MFence with architecture-independent barrier primitives
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
Replace Atomic_MFence with architecture-independent barrier primitives

Atomic_MFence was used to implement a full memory barrier on x86
architectures. In an effort to clean up duplicate code, this change
removes Atomic_MFence and replaces all previous uses with the most
conservative architecture-independent barrier primitive
(LDST_LDST_MEM_BARRIER). Since LDST_LDST_MEM_BARRIER is also a full
memory barrier, this change does not affect any existing ordering
semantics.

8 years agoFix timesync state to be uncalibrated when adjustment is large (>60ms).
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
Fix timesync state to be uncalibrated when adjustment is large (>60ms).

VMtools has timesync plugin to adjust guest time to match host time. Timesync
relies on a state machine (Uncalibrated, calibrating and PLL states) to
adjust the amount of guest time to match host time. If the guest and host
time differ by more than 60ms, state machine should reset to uncalibrated
state. There is a bug currently that would leave the state in PLL mode even
if the guest and host times differ by more than 60ms since absolute value of
adjustment is not considered. This causes the time sync to happen slower than
expected.

8 years agoSpecify the proper size while sending deploypkg.update.state RPC message.
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
Specify the proper size while sending deploypkg.update.state RPC message.

Due to a recent change, the VMX handler for 'deployPkg.update.state' RPC
ignores the message if the specified argument size doesn't match with
the string size.

In the current code, in a certain error code path, deploypkg plugin
specifies one extra byte in the size for 'deploypkg.update.size' RPC
message.  This results in an error at the VMX layer.

Fixed the code to specify the proper string length while sending the RPC.

8 years agoImplement ST_LD_MEM_BARRIER on x86 with a locked xor
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
Implement ST_LD_MEM_BARRIER on x86 with a locked xor

Microbenchmarks on modern Intel architectures show that a memory barrier
implemented with locked xor operation performs about 30% better when
compared to a barrier implemented with mfence, while providing the same
memory ordering guarantees. This patch changes the implementation of
ST_LD_MEM_BARRIER on x86 architectures to use the faster, locked xor
operation. Additionally, support for Microsoft's compiler is added.

8 years agoatomic asm snippets: Remove unnecessary uses of "clrex"
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
atomic asm snippets: Remove unnecessary uses of "clrex"

In our atomic asm snippets, we do not need to use "clrex".

8 years agoatomic asm snippets: Replace "memory" clobber with "Q" constraint
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
atomic asm snippets: Replace "memory" clobber with "Q" constraint

In our atomic asm snippets, using the "Q" constraint,
(https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html tells gcc
which exact memory is modified i.e. the bytes covered by the atomic variable),
is better than using the "memory" clobber (tells gcc that all memory is
modified, effectively a compiler memory barrier which prevents compiler
optimizations).

8 years agoresolutionSet/resolutionKMS: Work around DRM control node removal
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
resolutionSet/resolutionKMS: Work around DRM control node removal

DRM control nodes were removed in linux 4.10. Work with an updated
version of the vmwgfx kernel module and target render- or primary
nodes instead.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agovm_{atomic,uninterruptible}.h: Flip the polarity of the 32-bit function names
Oliver Kurth [Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)] 
vm_{atomic,uninterruptible}.h: Flip the polarity of the 32-bit function names

Initially, we only had 32-bit atomic functions, so their names did not have a "32" suffix.

Then, we added 64-bit functions. So,
1) We used a "64" suffix for them.
2) We provided additional names with a "32" suffix for the 32-bit functions, for consistency.

The hope was that, over time, references to unsuffixed names would disappear.
This change sends a stronger signal to developpers that the suffixed names
are the ones to use, and that the unsuffixed names are the undesirable legacy
ones to avoid.

8 years agovm_{atomic,uninterruptible}.h: Consistency cleanup
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
vm_{atomic,uninterruptible}.h: Consistency cleanup

This change brings a few dissidents back in line with the rest of the code.

Also deleted Uninterruptible_FetchAndAdd64():
o It was unused.
o It provided the same functionality as Uninterruptible_ReadAdd64(), with a worse name and implementation.

8 years agoAdd an error return to asyncsocket
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Add an error return to asyncsocket

Change asyncsocket to return a ASOCKERR_REMOTE_DISCONNECT when a
disconnection is detected during a send attempt.

8 years agoInclude sysmacros.h directly as mandated by glibc-2.25.
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Include sysmacros.h directly as mandated by glibc-2.25.

glibc-2.25 generates a deprecation warning for using 'major'
macro without including sysmacros.h.
https://sourceware.org/glibc/wiki/Release/2.25

This is breaking Fedora builds of open-vm-tools because
Fedora 26 is switching to glibc-2.25.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoRemove FileIO_GetVolumeSectorSize
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Remove FileIO_GetVolumeSectorSize

8 years agoFixed invalid class pointer access if VSS provider not installed
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Fixed invalid class pointer access if VSS provider not installed

Some customers may disable VSS support by not installing VMware snapshot
provider, which may lead to the VSS provider not being able to be
initialized, which in turn could lead to a invalid class pointer access
during complete initialization.

This change checks provider initialization status before initialize
completer to fix the issue.

8 years agoTools Hgfs Transport Logging: Migrate the to common tools conf logging
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Tools Hgfs Transport Logging: Migrate the to common tools conf logging

Migrate the tools implementations of the HGFS policy, server manager
and transport channels to use the common tools conf logging with the
"hgfsd" domain setting.

This allows the HGFS server core and the server managerand transport
components to be independently logged.

Changes are:
- Move the logging definitions into the server manager lib common header
- Add some log statements into the server manager public APIs
- Redefine the policy manager (share handling) logging to the general tools
logging.

8 years agovm_atomic.h: Build Atomic_uint128 upon uint128 instead of __int128
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
vm_atomic.h: Build Atomic_uint128 upon uint128 instead of __int128

Atomic_{8,16,32,64} are built upon uint{8,16,32,64}.
Atomic_uint128 is built upon __int128, which is inconsistent.
This change builds it upon uint128 instead.

8 years agovm_atomic.h: Implement Atomic_Bool operations on top of Atomic_uint8 operations
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
vm_atomic.h: Implement Atomic_Bool operations on top of Atomic_uint8 operations

The atomic code was inconsistent:
o On one hand we had Atomic_uint{16,32,64,128} basic types, on top of
  which we auto-generated more elaborate types such as Atomic_Ptr and
  Atomic_Int.
o On the other hand we had no Atomic_uint8, we had Atomic_Bool implemented
  as a basic type, and we had CMPXCHG1B (based on uint8, defined for
  vmkernel and vmm only, with an x86-specific name) that was implemented
  similarly to Atomic_ReadIfEqualWriteBool (based on Atomic_Bool, defined
  for everybody, with an architecture-neutral name).

This change brings a little bit of consistency:
o It defines Atomic_uint8 as a basic type.
o It auto-generates Atomic_Bool on top of it.
o It deletes CMPXCHG1B.

Also added a void * argument to AtomicUndefined(), which is used to
"consume" function parameters to prevent some compilers from warning
about unused parameters.

8 years agoRevert the previous commit.
Oliver Kurth [Fri, 15 Sep 2017 18:23:30 +0000 (11:23 -0700)] 
Revert the previous commit.

8 years agovm_atomic.h: Implement Atomic_Bool operations on top of Atomic_uint8 operations
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
vm_atomic.h: Implement Atomic_Bool operations on top of Atomic_uint8 operations

The atomic code was inconsistent:
o On one hand we had Atomic_uint{16,32,64,128} basic types, on top of
  which we auto-generated more elaborate types such as Atomic_Ptr and
  Atomic_Int.
o On the other hand we had no Atomic_uint8, we had Atomic_Bool implemented
  as a basic type, and we had CMPXCHG1B (based on uint8, defined for
  vmkernel and vmm only, with an x86-specific name) that was implemented
  similarly to Atomic_ReadIfEqualWriteBool (based on Atomic_Bool, defined
  for everybody, with an architecture-neutral name).

This change brings a little bit of consistency:
o It defines Atomic_uint8 as a basic type.
o It auto-generates Atomic_Bool on top of it.
o It deletes CMPXCHG1B.

Also added a void * argument to AtomicUndefined(), which is used to
"consume" function parameters to prevent some compilers from warning
about unused parameters.

8 years agoAccelerate some Atomic_* operations
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
Accelerate some Atomic_* operations

Unrelated to open-vm-tools.

8 years agoHgfs VMCI Transport: Part I fix the shared memory interface to not assert
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
Hgfs VMCI Transport: Part I fix the shared memory interface to not assert

THe HGFS VMCI transport uses the shared memory access functions to extract
HGFS protocol packets for the HGFS server processing and for returning results.
This interface recently changed to add thread tracking for these operations with
the addition of register and unregister functions.

The HGFS transport interface was missed on the initial change and hence now triggers
an assert as the register function call has not been made.

This is the first part of a change which addresses the assertion failure by adding the
register and unregister calls for the HGFS VMCI transport interface which uses this
shared memory.
The calls are part of a set of callbacks provided by the supported transports to the
HGFS server code for the VMX and tools. Since the backdoor transport does not make
use of the shared memory and access calls it just sets the function callbacks to NULL.
This is done for both the VMX backdoor channel and tools backdoor channel for packets
routed into the HGFS server.

This change does the following:
- Adds the register and unregister callbacks to the channel callback table.
- Modified the VMX VMCI channel to add the register and unregister callbacks and initialize
the callback table with these new functions which are then passed to the HGFS server.
- Modified the VMX and tools backdoor channels to NULL out the function pointers for the
register and unregister callback functions.
- Add the Hgfs server directory notification callbacks for register and unregister which are
termporarily protected by  ifdef statements as they are not yet called from the directory
notification component. These simply callback to the channel register and unregister functions
to do the real work if present for the channel in use. (Only VMCI will use this.)

8 years agoHgfs Server: Clean up logging macros and enable Hgfs Server tools logging
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
Hgfs Server: Clean up logging macros and enable Hgfs Server tools logging

The HGFS server logging macros are scattered throughout and repeated
in each source file. This makes it difficult to modify between the
VMX implementation and the tools. The tools side suffers currently and
is thus hard to debug.

This is the first in a couple of small changes to clean up the logging.

First the cleanup by moving the server logging statements for LOG to a centralized
private header file for the server code and not repeated in every source file.

Second, move the HgfsServer LOG from hgfs to its own HgfsServer setting.
New VMX file setting is:
Loglevel.hgfsServer = "10"

The current existing setting of "hgfs" will capture logging for the VMX
such as the HGFS manager, policy and transport interfaces (VMCI/Backdoor).

Third, the HgfsServer LOG statements for the tools builds (which go into
both instances of the vmtoolsd sevice/daemon) and the upgrader application
are now mapped to g_debug and Debug function calls respectively.
This now allows the tools configuration logging to set the following which will capture all
the Hgfs server logging:
hgfsServer.level = "debug"

Follow up changes will be made to check the tools backdoor transport interface log setting
which currently uses something like:
hgfsd.level = "debug"

8 years agoRemove LISP in vm_{atomic,uninterruptible}.h
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
Remove LISP in vm_{atomic,uninterruptible}.h

Unrelated to open-vm-tools.

8 years agoAdd Util_Memdup(); replace DynBuf_AllocGet() calls with Util_Memdup().
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
Add Util_Memdup(); replace DynBuf_AllocGet() calls with Util_Memdup().
Remove Util_CombineStrings() and Util_SeparateStrings().
  - lib/dynxdr/dynxdr.c
  - lib/include/dynbuf.h
  - lib/include/util.h
  - lib/misc/dynbuf.c
  - lib/misc/utilMem.c
  - lib/user/util.c

8 years agovm_{atomic,uninterruptible}.h: De-duplicate asm snippets
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
vm_{atomic,uninterruptible}.h: De-duplicate asm snippets

Unrelated to open-vm-tools.

8 years agoRevert previous commit.
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
Revert previous commit.

8 years agovm_{atomic,uninterruptible}.h: De-duplicate asm snippets
Oliver Kurth [Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)] 
vm_{atomic,uninterruptible}.h: De-duplicate asm snippets

Unrelated to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:28 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agolib/log: Remove GuestLog_* declarations from log.h
Oliver Kurth [Fri, 15 Sep 2017 18:23:28 +0000 (11:23 -0700)] 
lib/log: Remove GuestLog_* declarations from log.h

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:28 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.