VMware, Inc [Tue, 24 Aug 2010 18:19:22 +0000 (11:19 -0700)]
Fix StrUtil_StartsWith.
When the two strings diverge at the last non-NUL byte of the
prefix string, or at the byte preceding a trailing path separator,
the functions incorrectly return TRUE.
VMware, Inc [Tue, 24 Aug 2010 18:17:00 +0000 (11:17 -0700)]
Distinguish openSUSE from SuSE.
Workstation had a single "opensuse" key (as opposed to "opensuse10" and
"opensuse11") in guest_os_common.c. This was moved to guest_os.h and
used in lib/misc.
VMware, Inc [Tue, 24 Aug 2010 18:16:07 +0000 (11:16 -0700)]
Fix System_Uptime.
This change keeps the POSIX impl. of System_Uptime as a new function,
System_GetTimeMonotonic. This was done in order to keep around a
cheap routine suitable for use by the EventManager library.
VMware, Inc [Tue, 24 Aug 2010 18:15:33 +0000 (11:15 -0700)]
Bug 590562: vmtoolsd consumes 15% cpu all the time
In old VMwareUser we have a pointer loop which runs 10 times per second.
With new vmtoolsd we mistakely set the time interval to be 10 ms, which
means the pointer loop runs 100 times per second, and consumes lot of
cpu. Changing the time interval to 100 ms fixes the bug.
VMware, Inc [Tue, 24 Aug 2010 18:13:31 +0000 (11:13 -0700)]
VMCIDoorbell_Destroy: Assert when destroying non existent handle.
The VMCINotificationUnregister function in the vmci guest driver
was asserting FALSE when destroying a doorbell handle that does not
exist in the internal hash. This was causing the guest kernel to panic
when trying to destroy a handle that was already destroyed.
We should probably just return VMCI_ERROR_NOT_FOUND here instead of
asserting.
VMware, Inc [Tue, 24 Aug 2010 18:09:10 +0000 (11:09 -0700)]
Add a couple more tests to the vmtoolsd basic tests.
. add more fields to the test XDR struct to really make sure auto
marshaling / unmarshaling is working.
. validate the result of the "msg3" RPC so we check that auto
marshaling is working when returning data.
VMware, Inc [Tue, 24 Aug 2010 18:03:51 +0000 (11:03 -0700)]
PollDefault: Log lock data before ASSERT to aid debugging
Add a function to print out an MXUserRecLock's internal data, and use
that before an ASSERT in PollDefault that checks for real-time
callback that is starved by a lock. This is necessary as for some
reason the hostd cores that were generated due to this ASSERT never
have the state of the lock and the lock owner at the time of the ASSERT
(the lock is always free in the core and the thread that probably held
the lock is not anywhere such lock is held).
VMware, Inc [Tue, 24 Aug 2010 18:03:27 +0000 (11:03 -0700)]
Fix a possible buffer overrun. Remove an extra space character.
We want argBufPtr to point to the end of the argBuf buffer, where the '\0'
character is. So argBufPtr should be set to argBuf + strlen(argBuf).
Otherwise, if the argument string fully fills up argBuf, we could have
a buffer overrun when *argbufPtr = '\0' is performed.
The other change removes the extra space character at the end of
cmdLine in the ExtractCommandLineFromAddressSpaceFile function.
VMware, Inc [Tue, 24 Aug 2010 17:54:34 +0000 (10:54 -0700)]
When a handle being passed down to VMCIDoorbell_Create() was not initialized
to VMCI_INVALID_HANDLE, a doorbell was being created with context id 0
(hypervisor id) and a large resource id (likely the garbage value in
handle.resource).
On the guest side, modified VMCINotifyHashAddEntry so that if the handle
passed down is not VMCI_INVALID_HANDLE and if the context id of the handle
is not the context id of the VM, VMCI_ERROR_INVALID_ARGS will be returned.
VMware, Inc [Tue, 24 Aug 2010 17:51:42 +0000 (10:51 -0700)]
Changes for VIX Guest Operations support for Solaris.
The changes in this changeset collectively implement guest operations
support for Solaris VMs. The changes to each of the c files are
described in more detail below.
lib/procMgr/procMgrPosix.c, lib/procMgr/procMgrSolaris.c:
new implementation of impersonation and listProcesses for Solaris
lib/authPosix.c:
allow user authentication to work for Solaris
lib/misc/posixDlopen.c:
allow Posix_Dlopen for Solaris guests
lib/system/systemLinux.c:
allow System_[Set,Get]Env for Solaris, required for VixVM[Write,Read]Variable
service/plugins/vix/vixTools.c:
Enable calling of Guest operations for Solaris Guests
lib/file/fileIO.c, bora/lib/file/fileIOPosix.c
Allow solaris guests to call FileIO_Pread
VMware, Inc [Tue, 24 Aug 2010 17:48:47 +0000 (10:48 -0700)]
open-vm-tools cleanups.
. remove lib/resolution, now unused.
. remove duplicated stubs.
. remove checks for old glibc versions, add check for glibc 2.4.
. get rid of VMWARE_USER_LDADD.
. add HAVE_DNET so we don't use DNET_LIBS unless it's defined.
The "environ" variable seems to be a leftover from olden vmware-user days.
The ToolsAppCtx struct contains the native environent for plugins to use
in vmtoolsd-land.
Also add a new line at the end of unity.x to make rpcgen quiet.
Glibc version 2.2 dates from RedHat 7.1 (released 2001).
Any code we have on modern branches no longer works on
things that old (guest tools are frozen, hosted lost
support long ago).
This change removes a bunch of GLIBC_VERSION checks
from our code.
NOTE: GLIBC_VERSION_23 checks are still in use; we
support such old OSes (RH7.1-3, RH8.0, RHEL2.x) with
the guest tools build.
. stage the new sources.
. move unity-specific libraries to the new plugin directory.
. move unity/ghi XDR definitions to the new plugin directory.
. re-enable build of a few libraries used by the unity code.
. explicitly include str.h to avoid a compiler warning.
. move dndGuest.h back into the lib/include directory since unity
uses it.
cs 899353 added some broken code inside #ifdef GLIBC_VERSION_24.
Since GLIBC_VERSION_24 was erroneously never set, this went unnoticed
for a long time. This change creates a new Posix_EuidAccess()
function and calls it directly instead of embedding euidaccess()
inside FileAttributes() in lib/file. When Posix_EuidAccess() is
unavailable, the fallback uses FileAttributes().
This change does a little bit more than just remove the sources. It also
modifies the vmware-user-suid-wrapper so that it executes
"vmtoolsd -n vmusr" in open-vm-tools. The desktop file is also fixed to
execute the suid wrapper, which is the right thing to do.
Also remove locationsdb.c from open-vm-tools, since it's not used there.
Whoops. On Windows one must call an initialization routine for netutil
to be of any use. vmtoolsd handles this, but now that GuestInfo links
netutil in statically, this plugin must manage its own iphlpapi resources.
The log facility must use a lock. If the lock acquisition routine
were to use Log/Warning an infinite recursion is set up:
Log -> Lock -> Log -> Lock ...
It makes it imperitive that the log facility lock never have the
potential to emit a message. We just don't know where a developer
will place a Log/Warning.
The fix for this is an alternative lock creation routine, limited
to the recursive lock required for the log facility, that allows
the specification of a new parameter - beSilent (damn it!).
Ultimately this works because the core locking logic is inherently
silent; only the statistics code, if present, has to be bypassed.
Since this ultimately fixes a PR, the work-around to this issue
can also be removed.
lib/lock: Intel specific statistics are no longer true
Originally the timing routines used by lib/lock were RDTSC based,
making them Intel specific. Once nanosecond clocks were available
from lib/misc (i.e. Hostinfo_SystemTimerNS) the RDTSC and Intel
dependencies were eliminated.
This is trivial... remove the ifdef preventing statistics unless
they were Intel architecture.
The locking code can detect contention in two ways:
a) The number of failed acquisitions divided by the
total number of acquisitions.
b) Detected contention while successfully acquiring.
Use the larger of these two to report the contention ratio
for statistics. This provides a more flexible way to detect
any contention, regardless of how/what is reported.
Rather than have feature-specific code be a part of and versioned
with vmtoolslib, I moved the GuestInfo library code over to the
plugin directory itself. The only call into lib/guestInfo not from
the plugin was GuestInfo_GetFqdn, which I moved to System_GetNodeName.
lib/lock: move the stats data under a single pointer
Each of the MXUser object that collects statistics has its
statistical data ifdef compiled into its internal structure. Move
the statistical data into a private structure accessed from a
single pointer with the private structure.
This cleans up a lot of MXUSER_STATS ifdefs which become unnecessary
and get the code very close to being able to runtime turn on of
statistics in any build. For now, statistics are for stats builds only.
All this is done without introducing any overhead to speak of, only
one memory read from a cache line already loaded.
This is also a prepratory change to fix a problem in Log - the lock
allocation cannot call anything that might Log.
This was pointed out in comments from the original barrier review; I had
a "bullet proof barrier" change coming. Here you go.
Barriers are often used like this:
barrier
code
barrier
If the code is small enough or the code has a variable amount of
work and/or there are scheduler "funnies" it is possible to have
a thread arrive at the second barrier while threads are still exiting
the first barrier. That can lead to some very unobvious and strange
bugs.
The original barrier would detect this and assert. Let's do better.
This version catches the threads entering and parks them separate from
the threads leaving ensuring the everything works as expected; no
violation of the principal of least surprise.
This adds little in the way of complexity and memory use while
providing a great deal of protection (~type IIa).
The file locking code returned a "void *" for the lockToken. This
isn't as nice as using an opaque type. Alter the data type
and fix any affected code ccordingly.
Remove the pathName argument from FileLock_Unlock as it is now
unnecessary. This is essentially a mechanical change however the
fileTrack wrapper routine had to change to convert the lockToken
into a fileName so it could function properly, requiring a custom
function to be created.
The FileLock_Lock routine returns an abstract file lock token
representing the lock on the file. There is no functional need
to base the name of the file to be unlocked to FileLock_Unlock
since the token should already contain the necessary information
for the unlock.
This change lays the groundwork. The next one will clean up all
of the FileLock_Unlock callers. In the end all of this is being
done because "it's the right thing to do" and because Kevin has
a need for it - it will make a mainMem cleanup easier.
While doing this, provide a piece of missing functionality - determining
the length of the UTF8 string in code points (unicode characters). The
existing length routines return the length of the string is (physical)
bytes.
Merge common unity/ghi library changes from private branch.
This change touches the shares unity/ghi libraries, making them incompatible
with their current use in vmware-user. The plugin is not yet built.
Signal from unity plugin to dndcp plugin to notify transitions into
and out of unity state.
Merge common dnd code changes from private branch.
This merges common dnd code, and makes the code incompatible with its
current use in vmware-user. The plugin itself is not built yet. The
detWndTest test had to be removed from the build since it now fails
to compile.
This change removes the code from vmware-user, allowing it to build,
so that the installer builds still work. This allows changes in the
shared libraries (such as lib/dndGuest and lib/unity) to be made to
support the new plugins, before switching the installer to consume
them.
Drop (for now at least) the Unity features from the open-vm-tools package.
Always define VMW_NETCREATE_KERNARG for Linux 2.6.33+
To deal with the fact that a change from Linux 2.6.33 adding
an extra argument to the create field of struct
net_proto_family was backported to certain earlier kernels,
VMW_NETCREATE_KERNARG was introduces in change 1065091.
Instead of requiring all future PBMs for 2.6.33+ kernels to
specify the VMW_NETCREATE_KERNARG, we let VMCI sockets define
it for the appropriate kernels.
We should finish balloon cleanup before deleting ID space otherwise
we will crash when unloading balloon module if we have ballooned
pages at the time.
This bug was introduced during recent balloon cleanups.