VMware, Inc [Mon, 15 Oct 2012 04:56:10 +0000 (21:56 -0700)]
Add new privileged RPC call to RPC out library
Some tools require a privileged RPC out call for example the VGAuthImport for
the namespace DB interface.
This adds the RpcOUt_SendOneRawPriv call which will make a privileged RPC call
with the same arguments as the pre-exisiting RpcOUt_SendOneRaw API. It is expected
that the caller of the RpcOUt_SendOneRawPriv be running as root or Administrator.
The intention here is to keep the same model as the RpcOUt_SendOneRaw where the
caller can just make the standalone RPC call which internally handles the RPC
creation of a connection and destroys it before returning.
So the Posix RpcOUt_SendOneRawPriv expets the caller to raise and lower the IO
privilege level (on Linux platforms only) until the RPC internally calls a kernel
mode driver to do the real privileged call. On Windows, the
RpcOUt_SendOneRawPriv opens a connection to the kernel mode driver and
pass the RPC request to it to send and then close the driver connection before
returning.
VMware, Inc [Mon, 15 Oct 2012 04:55:51 +0000 (21:55 -0700)]
CopyPaste: accept TIMESTAMP data type for selection timestamps
The previous fix for copy and paste was pretty strict, and it turned out
to break X selections w/ the rxvt-unicode terminal emulator. (rxvt-unicode
returns selection data w/ data type TIMESTAMP instead of the ICCCM defined
INTEGER.)
VMware, Inc [Mon, 15 Oct 2012 04:54:23 +0000 (21:54 -0700)]
vmmemctl: fix a double free on linux balloon driver
On unload when using the unbatched commands, b->pageHandle would
be free two times. The first one when releasing all the pages of
the balloon, and the second time when releasing the batch
structures. This was causing OOPS and sometimes panic when rmmod
the driver.
The fix is to set b->pageHandle to PAGE_HANDLE_INVALID when it's
added to the chunks or when the page is released.
VMware, Inc [Mon, 15 Oct 2012 04:53:17 +0000 (21:53 -0700)]
vmmemctl: use capability based system to advertise balloon features
Use a capability based system instead of versioning to advertise
and negotiate balloon features.
On START command, the guest is sending its capability and the
monitor returns the masked capability. That way, the guest knows
exactly what features are supported by the monitor.
Currently the capability use two bits: if the bit 1 is set, then
the unbatched lock and unlock are supported, and if the bit 2 is
set, then the batched lock and unlock are supported. Bit 1 was
chosen to be backward compatible with "protocol v2", and bit 0
is unused to avoid issue with the screwed "protocol v3".
VMware, Inc [Mon, 15 Oct 2012 04:52:57 +0000 (21:52 -0700)]
Log_HexDump's second argument can/should be a const void *.
Make it so. That way we don't have to cast things at the callsite.
And remove some/most of the unnecessary typecasts while we're here.
And also make the third argument a size_t.
VMware, Inc [Mon, 15 Oct 2012 04:52:16 +0000 (21:52 -0700)]
GosTable: Server 2008 R2 32-bit never existed
According to Matt Delco Server 2008 R2 32-bit never existed. We can
remove it. This frees up a hosted bit which is good as it gives us
room to play in... until the don't use bits project is done (it's
just getting started).
VMware, Inc [Mon, 15 Oct 2012 04:52:06 +0000 (21:52 -0700)]
Gostable: minimal support for vmkernel6 and Mac OS 10.9
Implement then as aliases to their next earliest versions. We'll
revisit these as developments warrant. The SHOW_IN_UI is not on,
for now, so only in devel builds will they show up. Nor have I
changed the default showing for the UIs - that comes later.
VMware, Inc [Mon, 15 Oct 2012 04:52:01 +0000 (21:52 -0700)]
lib/misc: robustify Windows process checking
It is possible for a process to prevent itself for even having
it's name checked on Vista and later. We can use the denial of
access to determine is a process is alive.
VMware, Inc [Mon, 15 Oct 2012 04:51:02 +0000 (21:51 -0700)]
Fix HGFS server destroy session handler
The HGFS server destroy session handler should return the reply packet to
the client. Currently, it was deemed not warranted due to the reply only
having reserved fields. However, now that has been done, all clients cannot
validate the reply size correctly to include the full reply packet but only
accept the header size as mandatory. If they receive more than that they
can and should also validate the reply packet.
Currently, only hgfilecopy uses the destroy session, which does not look at
the reply packet at all and just uses the success or error returned. So these
changes will not break any clients currently.
VMware, Inc [Mon, 15 Oct 2012 04:50:29 +0000 (21:50 -0700)]
Guest OS table: add Debian 7 and SLES 12
These need to be added - and they are easy as they are aliases. No
bits need to be allocated. Find any place Debian 6 or SLES 11 is used
and add Debian 7 and SLES 12 respectively.
VMware, Inc [Mon, 15 Oct 2012 04:49:37 +0000 (21:49 -0700)]
VMCI/vSOCK: fix event soft lockup on Linux
We make the silly mistake of assuming in our QP event CBs that we are in BH
context, because we didn't ask for a delayed CB. But in this case, VMCI
doesn't make any guarantees about what context we are in, it could be BH or
process, we don't know. Fixed so that we don't make this silly assumption.
VMware, Inc [Mon, 15 Oct 2012 04:49:23 +0000 (21:49 -0700)]
VMCI: fix context locking.
Seems like we're holding the context list lock here, when we should
be holding the context lock (or possibly not holding any lock, but
we'll start with this).
VMware, Inc [Mon, 15 Oct 2012 04:49:10 +0000 (21:49 -0700)]
vmmemctl: add batching to the balloon driver.
Currently, we call the monitor for each reclaimed page. Batch
those pages and do a monitor call when enough pages have been
reclaimed. Ultimately, this should improve the performance by
reducing the number of context switch.
VMware, Inc [Mon, 15 Oct 2012 04:48:59 +0000 (21:48 -0700)]
Guestinfo: return an empty nicinfo if an error occurs.
If an error occurs while retrieving the network information then,
instead of ignoring error, guestinfon should return an empty nicinfo
so that all corresponding entries in the MOB, VMDB, will be set to
blank values and VI client will not show any stale data.
This change also fixes another issue. If any error occurs while
retrieving the primary 'ipaddress', guestinfo plugin now returns
a blank string so that VI client and other clients show the blank
value instead of stale data.
VMware, Inc [Mon, 15 Oct 2012 04:48:50 +0000 (21:48 -0700)]
Pass kernel version to depmod when installing kernel modules
When building Open VM Tools in chroot jail, jail kernel version could
be different from the actual kernel version and compilation fails.
Suggested fix is to use depmod -a $(KERNEL_RELEASE)
VMware, Inc [Mon, 15 Oct 2012 04:48:20 +0000 (21:48 -0700)]
Return proper error for ChangeFileAttributesInGuest API.
When a user executes ChangeFileAttributesInGuest(), the code calls
File_Exists() to check if the file exists. If File_Exists() fails,
then the code used to return a hard-coded error, but it is much
better to convert the errno/GetLastError() into a more meaningful
error.
VMware, Inc [Mon, 15 Oct 2012 04:46:48 +0000 (21:46 -0700)]
lib/file: make simple aio manager a little more thread safe.
The simple aio manager used a separate seek() then readv()/writev()
to do IO. This pattern is not thread safe with respect to multiple
threads accessing the same file. In particular, this affects
lazy checkpointing, since the IO to the mainmem file can come from
either the vcpu threads or the background save thread. This
change replaces these non-thread safe calls with preadv()/pwritev().
The simple aio manager needs FileIO_Preadv/Pwritev to return
number of bytes processed on partial IO. Modified the fileIO functions
to do so.
VMware, Inc [Thu, 2 Aug 2012 06:53:59 +0000 (23:53 -0700)]
lib/file: make File_Cwd() handle directories of any length
In the I18n world the current working directory can be essentially
unlimited in length. Using FILE_MAXPATH is outdated. Make File_Cwd
handle a current working directory of any length.
VMware, Inc [Thu, 2 Aug 2012 06:53:30 +0000 (23:53 -0700)]
Handle special files in HGFileCopy library.
Certain files like /proc/kallsyms can be copied from the guest only if
the special 'sequential open' mode is specified. This changeset removes
that constraint. Implemented the support in HGFilecopy library to
specify the sequential mode flag automatically if it thinks the remote
file is a special file.
This is done by implementing the support in hgfsServer to specify the
file as 'sequential only' if it thinks so. HGFSServer sets this bit when
the attributes are queried for the file. Implemented a new HGFile copy
option which a user can specify if he wants to automatically handle
the special 'sequential only' files. If the new file copy option is set,
then the HGFilecopy library automatically sets the 'sequential open' flag
if it thinks the file being copied is a 'sequential only' file.
Made changes to the vix library code to use the new HGFileCopy option
as default for the file copy functions.
VMware, Inc [Thu, 2 Aug 2012 06:50:55 +0000 (23:50 -0700)]
vSock: only print warning if we could not register address family at all
vSockets on Linux tries to claim an address family starting from the top
of the valid range. If someone has already claimed an address, we will
print a warning to the kernel log and then continue looping. This
warning started appearing on Cent OS 5.4 in autoinstall tests, presumably
because someone is grabbing the top family. Because the automation is
screenshot-based, the presence of the warning is causing the test to fail.
Fixed by moving the warning to the very end.
VMware, Inc [Thu, 2 Aug 2012 06:50:13 +0000 (23:50 -0700)]
lib/file: add support for preadv and pwritev
Earlier we just coalesced the vectors and called a single pread/pwrite.
This change checks if there is system support for these calls. In case
there is no support, we simply fallback to the older unoptimized code.
Performance tests showed promising results:
Test suite:
I ran tests with random 32k read/write IO access patterns.The number of
outstanding IO requests was set to 64. This was done on opt build with and
without my changes.
The following vmx config changes were made to disable buffering:
VMware, Inc [Thu, 2 Aug 2012 06:50:06 +0000 (23:50 -0700)]
lib/file: fix potential crash in FileRotateBy*()
The File_Rotate call may have a newFileName argument. If there is a
failure, and this argument is present we should set it to NULL to
prevent potential memory corruption or freeing garbage problems.
VMware, Inc [Thu, 2 Aug 2012 06:48:14 +0000 (23:48 -0700)]
Add an entry for 'oracle linux' in distroArray.
The 'guestinfo' plugin in VMware Tools is responsible for retrieving
details about the guest (like guest family, guest id, guest fullname
etc.). The 'guestinfo' plugin uses HostinfoOSData to retrieve the data
about the guest OS. HostinfoOSData() uses 'lsb_release' package to
reteive the details. If the 'lsb_release' command fails for some reason,
then /etc/*-release files are parsed to retrieve the necessary
information. There is a specific list of /etc/*-release files that are
parsed.
We don't have an entry for 'Oracle Linux'. We need to add an entry for
'/etc/oracle-release' file in the list. In 'Oracle Linux' guests, both
files '/etc/redhat_release' and /etc/oracle_release' exist. So, we need
to add the new entry in the code before the 'redhat' entry. Otherwise,
'/etc/redhat-release' is parsed first and improper information is
retrieved.
VMware, Inc [Thu, 2 Aug 2012 06:46:07 +0000 (23:46 -0700)]
Fix Lion guest and host files on shared folder show diff contents
The OS X hgfs client reference counts file handles that are shared for
accessing file data on the HGFS server. Unfortunately the implementor
failed to actually verify if the reference counting worked by testing
even the simplest sequence of file IO operations: opening a file,
reading it, and close should result in the reference count being set to
zero and the close request was sent to the HGFS server. This did not
occur, as a result the open handle remainded forever open on the server
until the HGFS server was forced to shutdown. This open handle was
reused for any further accesses from the client until it was rebooted.
The behavior of OS X (and Linux) file systems mean that the HGFS client
will only receive the data that it has written to that file or the
original data stored in the file which is now cached. If a host
application modifies the contents of that file the HGFS client will not
see it, until the old handle gets closed and a new one opened.
The fix is for the reference count for the open handle to be correctly
handled. This will mean that the matching close for an open handle will
reduce the reference count to zero and therefore a closse request will
be sent to the HGFS server. The next access to the file will get the
latest file data on disk from the host.
VMware, Inc [Thu, 2 Aug 2012 05:31:59 +0000 (22:31 -0700)]
Fix HGFS file append on OS X
File appends were incorrect on OS X as they appear to be handled
differently by posix pwrite calls from Linux. On Linux if the handle is
opened for append mode then pwrite will ignore the offset and append to
the file. This is not correct for OS X, where the offset is still used.
For OS X we now check if the handle is opened for append and use the
write call instead.
VMware, Inc [Thu, 2 Aug 2012 05:31:17 +0000 (22:31 -0700)]
Print warning messages before the wipe/shrink process
During the wipe process, the toolbox cmd CLI first fills the guest's
disk space with file filled with zeroes. During this step, user may
notice few warning messages about the available free disk space in the
guest operating system. We should print a message to disregard the disk
space messages in the guest operating system.
VMware, Inc [Thu, 2 Aug 2012 05:30:57 +0000 (22:30 -0700)]
VMBLOCK: fix panic on unmounting on FreeBSD 9.0
FreeBSD added a new operation vop_advlockpurge that is called
from vgonel() after an inode was released. We should not attempt
to pass this operation down to the underlying filesystem and
instead install vop_stdadvlockpurge() as our handler, exactly like
nullfs does.
Although there wasn't explicit bump of __FreeBSD_version for this
change, 900013 is the closest one and we'll use it to detect when
when we need to install vop_advlockpurge handler.
VMware, Inc [Thu, 2 Aug 2012 05:29:55 +0000 (22:29 -0700)]
Fix asm constraint for Set/Test/ClearBitVector
Compiling this assembly with gcc-4.4.3 in i686 results in a
compilation error stating that %dil is not a valid register.
GCC experts state that the compiler is correct and the
problem is in the assembly constraints:
https://bugzilla.redhat.com/show_bug.cgi?id=625263
(Summary for uninitiated: %dil is the low 8 bits of %edi,
which is addressible in x86_64 but NOT in ia32)
Slightly more detail: the setc instruction takes an 8-bit
operand. Which means any register chosen must also be
an 8-bit register (ia32: al, bl, cl, dl). The 'q' constraint
means "any register addressible with the -l suffix", which
is the correct constraint. At Jim's suggetion, I'm also adding
'Q' (ia32: ah, bh, ch, dh). Note that in x86_64, 'q' covers
all registers, so 'q' vs. 'r' does not hurt x86_64.
I also note that bts specifically alters CF (and we are indeed
using setc to read it!), but "cc" is not on the clobber list.
It was present on the clobber list of all the other assembly
fragments, so I suspect this was an oversight.
Why didn't we see this before?
- These BitTest funcs tend to be used only in VMX
- The only VMX that builds with gcc-4.4.3 today is ESX's, which ix x86_64
- The Linux Workstation vmx32 uses gcc-4.1.2
- (I'm experimenting with bumping Workstation Linux's gcc)
There are no correctness concerns; if constraints were wrong, the
code would fail to compile entirely due to incorrect register
selection.
VMware, Inc [Thu, 2 Aug 2012 05:29:38 +0000 (22:29 -0700)]
MsgList_Create: annotate with printf declaration checker
MsgList_Append has the printf declaration checker attribute
in place. I believe at the time, there were a few MsgList_Create
calls that had to be turned into MsgList_CreateStr; this change
has since happened. Which means the format specifier check
can now be fully enabled.
VMware, Inc [Thu, 2 Aug 2012 05:29:18 +0000 (22:29 -0700)]
Internal branch sync. Included in this change:
. fix bug in ListAlias APIs - sloppy use of arrays vs pointers
. vmxnet3 - fix MTU management in Solaris version:
- do not start with MTU as 9000 but as 1500;
- check if accept-jumbo was set before increasing MTU above 1500;
- allow initial MTU to be picked up from vmxnet3s.conf;
- update max sdu when MTU changes on OpenSolaris and on Solaris 11
. vmballon - add versioning to the balloon driver handshake
. Fix up FileIsVMFS() so it correctly identifies VMFS*
. changes in shared code that don't affect open-vm-tools functionality
VMware, Inc [Thu, 2 Aug 2012 05:28:12 +0000 (22:28 -0700)]
Prevent crashes on invalid message strings in release builds
There might be Msg_Append call sites that pass in a raw string that
lacks message ID. We assert in debug builds, but end up dereferencing
an invalid pointer in release builds. Let's make up a generic error
message out of the raw string instead.
VMware, Inc [Thu, 2 Aug 2012 05:27:49 +0000 (22:27 -0700)]
vSock: Consolidate provider info
Our provider protocol structures were scattered across three different
installers. Just move them into a single header, one that is already
included by everyone.
VMware, Inc [Thu, 2 Aug 2012 05:26:12 +0000 (22:26 -0700)]
GOSTable: New Mac hardware, new GOSTable bit
We need a new GOSTable bit for darwin12 to cover the new bridge and CPU
architecture... we need to provide monitor specific settings appropriate
to the OS.
DARWIN12 will be 64-bit only so we can drop a 32-bit entry.
Clean up any fallout.
Once the monitor settings have been finalized a follow up change will
deal with monitor settings.
VMware, Inc [Thu, 2 Aug 2012 05:26:04 +0000 (22:26 -0700)]
Fix error on file deletion on read-only HGFS share
The failure was being done at the set file information call of the
Windows client instead of the create call. This only occurred when
communicating to HGFS servers on Posix platforms. The Posix platform
only uses the open mode of the HGFS open protocol request even if the
desired access is valid. On Windows HGFS servers the desired access is
checked and used if valid, and if not falls back to the Posix open mode
call.
However, for the case of delete requests, the Windows client does not
set up the Posix open mode quite correctly. It igonores the DELETE
desired access flag. This should be mapped to a Posix open mode
requesting write access. So for occasions where read attributes and
delete is requested in the desired access the Posix open mode is still
passed as read-only. This causes the open to succeed on a read-only
share when it should be failed with access denied.
This fix is to address the HGFS Posix server to try to map a Windows
client passing the desired access mask to the Posix open mode will then
allow all Windows clients to have the open for delete access validated
by the HGFS server. Linux clients are unaffected and do not use this
field for the open requests. It also has the benefit of making the
Posix and Windows HGFS servers more compatible.
VMware, Inc [Thu, 2 Aug 2012 05:24:55 +0000 (22:24 -0700)]
Fix toolbox 'shrink' feature on newer distributions using bind mounts
VMware toolbox-cmd utility provides two disk related features i.e.
shrink and wipe. When the user executes 'shrink' or 'wipe' command, the
utility parses /etc/mtab and checks if there is an entry matching the
specific mount point. If a match exists, then the utlity immediately
stops the parsing. This approach is not very robust and may cause few
issues especially if there are multiple entries for the specified mount
point. If the first entry maps to an unsupported partition type and the
second entry maps to a supported partition type, the current parsing
logic returns EX_UNAVAILABLE error. We should fix this.
Modified the code to continue parsing the entries if the first match entry
maps to an unsupported partition type.
VMware, Inc [Thu, 2 Aug 2012 05:24:32 +0000 (22:24 -0700)]
VIX: directories created via VIX api should have 0700 permissions
There are visibility issues with the directories created via VIX apis
(VixVM_CreateDirectory). All the directories created via VIX apis should
be tagged with 0700 permissions instead of 0755 permissions.
Added few Ex functions in file.c to create directories with the specified
permission. Modified the vix tools code to create the new Ex functions
with the specific permission mode.
VMware, Inc [Thu, 2 Aug 2012 05:21:40 +0000 (22:21 -0700)]
GuestInfo: ignore the extra NIC information
If the total number of network interfaces configured for a VM exceeds
the maximum XDR limit, then the guestInfo plugin crashes.
GuestInfo plugin calls intf_loop() to retrieve the information about all
the available interfaces. ReadInterfaceDetails() is passed as a callback
function to intf_loop(). Add a check for the number of NICs processed
and ignore the extra NIC information. By doing this, VMware Tools
returns the maximum information that it could return and drops all the
extra NIC info on the floor.
VMware, Inc [Thu, 2 Aug 2012 05:21:29 +0000 (22:21 -0700)]
VMCI: Restrict access to VMCI_RPC_PRIVILEGED
As a temporary hack, we had opened up access to the privileged RPC
handler to all users. This fix locks it down again: on Linux, only
the superuser can access it, while on other platforms, it is denied
completely (until we add seq packet support to the common code).
VMware, Inc [Thu, 2 Aug 2012 05:20:26 +0000 (22:20 -0700)]
Cleanup and rearchitecture of HGFS server change notification part VII
Final initial change set for fixing FSEvents polling for Lion OS X 10.7.
This is currently an OS X host only file, but now contains the main logic
to handle the file system change notifications and is platform independent.
The OS X platform specific code is now in hgfsFSEventsMac files.
In a later change set this file will be renamed to reflect that it is
common to all platforms while the platform dependent parts will implement
the FSEvent API (as done for OS X in part VI).
Currently only the OS X platform supports the change notification feature
and as such only the scons build file has been changed.