VMware, Inc [Thu, 2 Aug 2012 05:19:43 +0000 (22:19 -0700)]
Don't use $HOME to get the current user's home directory on Mac OS
There are some cases on Mac OS where the $HOME environment variable has
not been set even though the current user does have a valid home
directory. For example, if you enable the "root" user in the UI and then
try to start Fusion via Finder, it would fail spectacularly because it
was unable to figure out the Log and Preferences directories.
In lib/misc, for Mac OS, instead of resorting to $HOME in the case where
we are trying to expand "~" for the current user, we instead use the
posix passwd API, which according to the man page is properly hooked up
to DirectoryServices and thus will give us any user's homedir even if it
isn't actually in the /etc/passwd file.
VMware, Inc [Thu, 2 Aug 2012 05:18:49 +0000 (22:18 -0700)]
Fix time synchronization when restarting tools
When the tools are restarted, and the clock is modified (out of sync
with the host's clock), if 'timeSync' feature is enabled, then the clock
is not synced. This happens only first time after the tools are
restarted. There is no issue from the second time onwards.
In the code, we do the one step synchronization only if the tool status
is stopped. Ideally, we should do this one step synchronization the first
time even after the tools are restarted. This is fixed by setting the
tools status to stopped when the tools are restarted initially.
VMware, Inc [Mon, 21 May 2012 22:29:00 +0000 (15:29 -0700)]
Remove objectionable code from authPosix.c
Auth_AuthenticateUser in authPosix.c, for both the PAM and non-PAM
paths, has a short-circuit enabled by defining ACCEPT_XXX_PASS. When
defined, anyone can login simply by specifying "XXX" as the password.
There is no evidence this has ever been enabled in production code, but
it's apparently X-rated enough that we want it gone immediately.
VMware, Inc [Mon, 21 May 2012 22:28:43 +0000 (15:28 -0700)]
Add PRINTF_DECL to MsgList_Append
Use PRINTF_DECL to validate proper message format and arg count for
MsgList_Append. And fix the two remaining errors on compile (others were
fixed while found).
VMware, Inc [Mon, 21 May 2012 22:28:03 +0000 (15:28 -0700)]
Fix vSockets stats on Linux.
Unfortuntely these have been broken since we switched over to
the QPair interface. The stats are handy, so let's fix them.
Also keep track of total bytes consumed/produced.
VMware, Inc [Mon, 21 May 2012 22:27:39 +0000 (15:27 -0700)]
Update iOS sdk to 5.1 from 4.3 for mobilelibs.
Change the compiler to apple llvm 3.1(clang) from gcc. This patch mainly
worked on three things. Related Makefiles of mobilelibs target are
modified. Because clang requires explicity of the returen value from
the MACRO, I changed the ThreadUtils.c to return the value. Add the
preprocess MACRO to separate the header files for IA-32 from non-IA-32
in atomic.c . Add the implementation of RoundupPow2Asm32 for ARM (none
thumb) in vm_basic_asm.h .
VMware, Inc [Mon, 21 May 2012 22:27:30 +0000 (15:27 -0700)]
Introduce SOCK_SEQPACKET to vSockets.
Finally, the mythical sequential packet socket type appears. This socket
type is specifically for guestRPC, over which Tools can communicate with
the VMX. It is *not* a general sequential socket type: while you can
certainly make these sockets on the host, they won't be able to connect
anywhere, and you can't open such sockets inside the VMX, you can only
receive connections from the guest.
It works by using DGRAMs underneath. vSocket DGRAMs are bit-compatible
with VMCI DGRAMs, so we can get from vSockets in the guest directly to the
VMX, without having to go through the host vSockets driver.
To make it connected and reliable, we introduce a very simple protocol
using a new packet format. It consists only of CONNECT, DATA, SHUTDOWN and
CLOSE (the latter two being mostly the same as far as the VMX is
concerned). Datagrams going to the VMX are already reliable. In the
other direction, if we fail to receive, we send a CLOSE down with an error
(unlike the STREAM protocol, I actually remembered to embed an error code
this time). For DATA packets, we place payload after the packet header.
We have to copy in from user-mode anyway, so it doesn't add any copy
overhead.
This is part 1, which is the Linux guest side. It adds a new socket type
to our family and implements the appropriate socket functions (things like
accept() and so forth are just unecessary).
VMware, Inc [Mon, 21 May 2012 22:27:15 +0000 (15:27 -0700)]
vmblock, HGFS: allow compiling on kernels 3.4+
Commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b removed d_alloc_root()
(it was replaced by d_make_root), adjust our code to call the new
function and provide the replacement on older kernels.
VMware, Inc [Mon, 21 May 2012 22:26:42 +0000 (15:26 -0700)]
Fix HGFS build
For some reason gcc options for hgfs are not happy with typecast
of 'const void *' to 'volatile void *'. I have no idea why, as I
thought that that is what casts are for, but for now let's do not
typecast that thing. That should keep HGFS happy.
VMware, Inc [Mon, 21 May 2012 22:26:37 +0000 (15:26 -0700)]
hostinfoPosix.c: remove reference to sys/timeb.h
sys/timeb.h is deprecated in FreeBSD9.0 and may cause compilation
warnings turning into breakages when building Open VM Tools.
Luckily we are not using ftime() that this header declares, so
we can simply get rid of it.
There are functions which operate on 32bit and 64bit variables, but
their inline assembly is not suitable for bigger arrays without forcing
variable they operate on always to memory, which is not desirable.
Existing functions also do not report previous value of the bit.
So let's roll out versions that can operate on bit arrays. As all I
need is 256 bits, I've implemented only version with 32bit index.
VMware, Inc [Mon, 21 May 2012 22:26:28 +0000 (15:26 -0700)]
vPageChannel: Failed to allocate packet (channel=ffff880013fda380) (size=69600)
We're trying to perform really large atomic allocations, for example
when allocating a packet to send receive buffers down to the host. Such
allocations can be hard to fulfil when the kernel cannot block. So make
the chunks even smaller when we're in an atomic context.
One potential downside to this is that we will signal a lot, i.e., we're
going to signal 16x more for page-sized than for DGRAM-sized packets. We
fix this by writing out all of the packets and then only signalling
afterwards. The peer is okay with this: it may peek a packet header but
then not see sufficient data in the QP to be able to read the rest, so it
will bail out, leaving the packet for when all the sends are complete and
it gets signalled.
The other, and more proper, way to fix this is to change the interface so
that packets are iovecs of page-sized chunks. That's a somewhat more complex
change that we aim to do for v2 anyway (actually we'll have packet lists,
and each packet in the list will be split into page-sized chunks, and each
chunk will hold actual PPNs).
VMware, Inc [Mon, 21 May 2012 22:25:07 +0000 (15:25 -0700)]
Fix a missing break in MXUser_ControlExclLock.
MXUser_ControlExclLock(lock, MXUSER_CONTROL_ENABLE_STATS, ...) would always
return FALSE due to a missing break... it'd always fall through to the
default case. No-one seems to care about the return value of the function
so far...
VMware, Inc [Mon, 21 May 2012 22:25:04 +0000 (15:25 -0700)]
Fix vSphere client/vim-cmd not showing IPv6 addresses
The nicInfo structure was not getting populated because the
RecordRoutingInfo function was failing as IPV4 wasnt configured on the
VM (even though IPV6 addresses were configured).
VMware, Inc [Mon, 21 May 2012 22:24:19 +0000 (15:24 -0700)]
Add support for promoted AVX2 instructions
This changeset adds support for AVX instructions promoted to enable
use of the full 256bits of the ymm regs by the AVX2 feature set. This
changeset does not introduce any new instructions or encodings. It
just honors the VEX prefix 'L' bit used to indicate the width of the
source and destination operands. Previously, these instructions
would result in a #UD fault under AVX if VEX.L==1.
VMware, Inc [Mon, 21 May 2012 22:24:09 +0000 (15:24 -0700)]
DescriptorWrite: revert to in-place write on NFS
The ESX NFSv3 client can't handle rename. So we need to switch back to
the write-the-descriptor codepath on NFS on ESX.
Note that even though we don't use the result of the AtomicTempFile
creation, failures to create/write the AtomicTempFile are still
treated as fatal (see descriptor.c: errorWriteDirect
HostType_OSIsVMK); while there are a few scenarios where we might
be able to continue despite them, the storage is fatally sick
and we should error early rather than limp along. Furthermore,
special casing these failure paths requires significant additional
code (and therefore development work and risk) with no benefit.
VMware, Inc [Mon, 21 May 2012 22:24:04 +0000 (15:24 -0700)]
Add NULL checks before accessing logger attribute.
When we login into a VM, a new VMware Tools process starts with the
logged in User account. If the logged in user is the least prviliged
user (guest account in Windows 8), then the process may not be able to
create a logger handler. GlibUtils_Create*Logger() functions may return
NULL. In such case, accessing the logger handler may result in a crash.
Modified the code to add proper NULL checks everywhere before
accessing the logger handler.
VMware, Inc [Mon, 21 May 2012 22:23:16 +0000 (15:23 -0700)]
Add support for processor groups to Windows vmmon
Many OS APIs represent processors using a uintptr_t bitfield.
Processor groups were added in Win7/W2K8R2 to get beyond the limit
of 64-bit processors on x64. Currently at most 4 groups, or 256
processors, are supported. This happens to match the current
max pcpus define.
This change utilizes the Win7 WDK and procgrp.h, which uses
some #defines and thunking to use the native newer APIs on
Win7-and-later, while emulating the behavior on older OSes using
older existing APIs.
By default a process is limited to one processor group. Certain
operations, e.g., get/set TSCs will only be performed across the
processor group that the vmx process is running on.
HostIF_CallOnEachCPU() will eventually need to be modified to run
across all processor groups rather than the current processor group.
The vmx still needs to be modified to do a more elaborate determination
of the # of processors because the standard OS APIs only return the
vmx passing down a buffer that's too small for IOCTL_VMX86_GET_ALL_MSRS.
This function is also used as part of Task_Terminate()'s call to
TaskIsVMXDisabledOnAllCPUs(), and the call to Vmx86_EnableHV that's
triggered by IOCTL_VMX86_ENABLE_HV.
I also removed some logs that spew too much when running a VM
with a kernel debugger attached.
VMware, Inc [Mon, 21 May 2012 22:22:54 +0000 (15:22 -0700)]
Make the first of a few changes to accomodate Haswell.
The new Haswell CPU seems to behave like the other newish Intel
architectures, so in the main the changes needed are simple. I've added
the macros to allow for detection for the model family and
architecture. The interpreter changes are to make the interpreted
results consistent with native execution. I also added Haswell to the
list of architectures supported by vpmc. The test changes are the
counterpoint to the monitor changes.
VMware, Inc [Mon, 21 May 2012 22:22:39 +0000 (15:22 -0700)]
resolutionSet: Correct a use-after-free bug
Customer opened a thread in the Workstation forums noting he had trouble
entering Unity.¹ After some back and forth, even after seeing that
XRRSetScreenConfig claimed success,² this function would return failure.
Here's why:
XRRScreenConfiguration *xrrConfig = XRRGetScreenInfo(...);
XRRScreenSize *xrrSizes = XRRConfigSizes(xrrConfig, ...);
/* xrrSizes simply points to a member of xrrConfig. */
After the call to XRRFreeScreenConfigInfo, xrrSizes is no longer valid.
Whether SelectResolution succeeds is ultimately a matter of luck w/r/t
underlying implementation details. (“Does XFree() alter the contents
of freed memory?”)
1. http://communities.vmware.com/thread/397056
2. We threw away XRRSetScreenConfig's return value. While this change
doesn't alter logic to depend on this value, it's still at least worth
logging.
VMware, Inc [Mon, 21 May 2012 22:21:49 +0000 (15:21 -0700)]
Audit and remove VMX86_WGS
wgs/gsx/server (non-esx) code still lives within its older still active
siblings. I located as much as possible and removed its dependencies and
tried to make appropriate changes related to the code being removed.
This change had the potential to remove a lot of other old products and
tools, but I resisted that temptation (console, mui, ccagent to name a
few). For the most part it was a standard removal.
VMware, Inc [Mon, 21 May 2012 22:21:13 +0000 (15:21 -0700)]
GOS: bit shaving
As things stand we can only have 64 unique types of guests for
hosted products. We used them all up and need to add more guest OSen.
Collapse some less important explicit GOS OSen bits together, adjusting
any visible strings accordingly.
We have legal agreements with certain parties that require us to
show an explicit recognition of their product (e.g. RH) so some
things cannot be done away altogether... but we can bit on parties
not likely to complain.
Since the monitor doesn't need to know about differences, collapse
Solaris 6 and 7 together, RHEL 6 and 7 together and SCO OpenServer
5 and 6 together.
Total savings 4 bits (50 cents!). More than enough to add the one
critical addition and leave room for growth in shipping product
until we can implement a system that does away with the 64 guest
OSen limitation.
VMware, Inc [Mon, 21 May 2012 22:21:05 +0000 (15:21 -0700)]
GOS: is it an enum or not
Some time ago the GOS table ID values were changed from defines to
an enum however the "enumity" of the values was not fully plumbed
through the source base. Fix this so we get all of the type checking
and visual goodness.
Did a little bit of grouping/rearranging to the guest ID list to make
it clear that the order can be changed (it's for internal use only).
This will make it more obvious how many of each OS we have and make
searching for things that can be compacted easier.
This is the first of a series of changes to create some room for
more guest OSen - we're limited to 64 as things stand (and they
are all used).
VMware, Inc [Mon, 21 May 2012 22:20:53 +0000 (15:20 -0700)]
VMCI: Set source context ID for DGRAMs destined for VMX
In the routing code, we overwrite the ANY source context for DGRAMs
destined for the host so that the destination knows who sent it. We should
do the same for DGRAMs destined for the VMX, so that guestRPC knows who
to reply to.
VMware, Inc [Mon, 21 May 2012 22:20:07 +0000 (15:20 -0700)]
Fix vmxnet_load_multicast() function
In kernels version greater than 2.6.34 the vmxnet_load_multicast
function used to return the entries to compute the LADRF used to return
0 always. Due to the above reason the IPV6 wasnt working after VMware
Tools installation with upgraded kernel. Modified the function to return
the correct value.
VMware, Inc [Mon, 21 May 2012 22:19:56 +0000 (15:19 -0700)]
Fix File_PathJoin ASSERTs some more
I think that File_PathJoin's ASSERTs were a bit too aggressive. I
believe that the intention was to disallow UNC paths for the tail
portion of the path, not to disallow all paths that start with a
directory separator. (Allowing a leading directory separator on Linux
but not on Windows seems a bit dangerous anyway.)
VMware, Inc [Mon, 21 May 2012 22:19:50 +0000 (15:19 -0700)]
Add support for BMI2 instructions.
The upcoming Haswell CPU adds 8 new instructions advertised via
a new BMI2 bit from the cpuid instruction. This change set adds the
definitions for 6 of the 8 that can be methodically added to the
existing decoder tables. The remaining 2 instructions require a
bit of custom code and will appear upcoming reviews.
Instruction definitions taken from:
"Intel Architecture Instruction Set Extensions Programming Reference"
February 2012.
New instructions: BZHI,PDEP,PEXT,SARX,SHLX,SHRX
VMware, Inc [Wed, 14 Mar 2012 18:00:05 +0000 (11:00 -0700)]
USB Arbitrator: split version into vm_usbarb_version.h
I swear that half of changes in open-vm-tools repositoty
are due to arbitrator version updates recorded in vm_version.h.
Let's split it out into vm_usbarb_version.h that we do not need
to ship to make my job easier.
VMware, Inc [Tue, 13 Mar 2012 20:15:35 +0000 (13:15 -0700)]
Make VMCI Socket protocol header definition public
The upcoming VMCI firewall feature needs to understand the
protocol format used by control packets for VMCI sockets. This
change moves the definition to a new file in the bora/public
for easier consumption by the VMCI module.
VMware, Inc [Tue, 13 Mar 2012 20:13:23 +0000 (13:13 -0700)]
Introducing new XML tag <cmd>...</cmd> for command name in ListProcessesInGuest.
This is to relieve VIX Client code from having to parse OS specific
command names from the full command line, except for Windows, which
has been left as it is. Without this fix, current implementation on
Mac, Linux, Solaris and FreeBSD are broken whenever we have folders
or executable file names with blanks spaces in them.
VMware, Inc [Tue, 13 Mar 2012 20:11:53 +0000 (13:11 -0700)]
Improper ASSERTs in vmx cpuid handling
2 ASSERTs can trigger due to input values from the guest cpuid call. The
first one happens if the input level falls within the valid low range
level, but hits a hole where no level exists. The second ASSERT triggers
if the ecx value is out of range for the TOPOLOGY level on Intel. The
fix is to handle the values at runtime and not assert. Also fix a
couple of line wraps.
VMware, Inc [Tue, 13 Mar 2012 20:11:07 +0000 (13:11 -0700)]
Fix callback in vmcilib
There's a nasty bug where, if the detach callback gets invoked at the
same time that the client is releasing, we can end up executing after
the client has unloaded. The problem is that the callback will wait on
the lock, and once Release() lets it go, the client is allowed to unload.
The lock, and the rest of the code for the callback, is then gone.
The fix is two-fold:
1. Use the system callback mechanism. This utilizes callback objects
stored in the system object table. The callback object is shared between
the publisher and the subscriber using a symbolic name. This provides
a level of indirection between VMCI and vmcilib, i.e., they don't have
to rely on each other being around.
2. Introduce a new function, VMCI_Exit(). The client calls this function
when it unloads, at PASSIVE level, with no locks held, and this
unregisters from the callback. So the new workflow for a client is as
follows:
The above changes require no modification to the VMCI/vmcilib IOCTLs and
so are backwards-compatible with shipping clients that do not use
callbacks (we haven't yet shipped any that do).
VMware, Inc [Tue, 13 Mar 2012 20:10:34 +0000 (13:10 -0700)]
Change File_CreateDirectoryHierarchy to enable "undo"
When calling File_CreateDirectoryHierarchy, there was no way to know
what was actually created by the call and what wasn't. This meant that
trying to be a good neighbor and clean up after ourselves if whatever we
wanted the directory for failed (or was cancelled) wasn't possible.
This change adds an optional OUT parameter to that gets set to the
top-most directory which was actually created by the call. If the caller
then wants to clean up, they can pass that into
File_DeleteDirectoryTree.
VMware, Inc [Tue, 13 Mar 2012 20:09:39 +0000 (13:09 -0700)]
No need to lock twice before accessing VMCI context queue pair array.
The VMCI context keeps track of queue pairs allocated by that
context in a handle array. This handle array is always
accessed while holding the general queue pair lock, so we do
not need to grab the context lock as well. In fact, the header
file already describes this. So drop grabbing the context lock
for queuePairArray.
VMware, Inc [Tue, 13 Mar 2012 20:09:34 +0000 (13:09 -0700)]
Fix tools uninstall crash when stopping vmuser
During uninstall/upgrade, tools launches
vmtoolsd.exe -n vmusr --kill
to stop the existing user process. The new instance however
crashes before it could send the message, and therefore the
existing vmuser process remains.
The problem is uninstall doesn't wait for the process to
finish, and proceeds with the uninstall. This removes the
Tools registry entry which vmtoolsd.exe tries to read on
startup. It hits the assert and crashes the process.
The fix is in two places. We fixed vmtoolsd.exe so it doesn't
assert if the registry entry doesn't exist, and updated the
installer to launch and wait for the process to finish before
continue.
VMware, Inc [Tue, 13 Mar 2012 20:09:18 +0000 (13:09 -0700)]
Snapshot's file absolute path must be respected
It is just wrong to take an absolute pathname, truncate it to a basename,
then do a path search on the basename to find the file. It seems incredible
that such a blunder has existed in a common routine since 2004.
Made path search semantics more sensible: only unadorned basename
is searched via path.
VMware, Inc [Tue, 13 Mar 2012 20:08:57 +0000 (13:08 -0700)]
Widen MainMem pagenums.
This change widens the MainMem pagenums to 30 bits, in order to
support up to 4TB of vRAM. BPN_MAINMEM_TAG is bit 30 now. For
non-mainMem BPNs, the slot bits move into bits 23-29.
VMware, Inc [Tue, 13 Mar 2012 20:08:42 +0000 (13:08 -0700)]
Check for NULL before calling strcmp().
In few code paths, we pass NULL value to the strcmp() functions which
may result in a crash. Modified the code to implement NULL checks
before calling strcmp() function.