VMware, Inc [Mon, 21 Nov 2011 22:48:42 +0000 (14:48 -0800)]
Avoid passing NULL channel to message library.
I've looked at this code countless times, and can't come up with
an explanation for why the bug happens without resorting to
time drifts, quantum physics and possible questionable behavior
of the glib main loop implementation. So just avoid the issue
by having an explicit check.
I've never been able to hit it myself either, to get a good
debug session going on, and the cores I've seen have been
less than helpful.
VMware, Inc [Thu, 27 Oct 2011 18:48:33 +0000 (11:48 -0700)]
Fix ternary operator usage in assert macros
A couple of our ASSERT macros use the ternary operator without casting
both operands to the same type. This is required for C++. bora does
not have any usage of these macros in C++ code, but it breaks the build
on sysimg branch.
VMware, Inc [Thu, 27 Oct 2011 18:47:27 +0000 (11:47 -0700)]
vmtoolslib: use the new generic glib logging functions.
This change replaces the vmtoolslib logger implementation with the
"glib utils" library that was recently added. I also simplified a
little the re-configuration code, both because the new loggers don't
have the old "copy" function and because the old code was kinda
confusing.
VMware, Inc [Thu, 27 Oct 2011 18:44:00 +0000 (11:44 -0700)]
Leak tls key 0
We have a couple of bugs that show system libraries on linux have a
nasty habit of destroying the first TLS key, even if they don't own it.
This is due to using uninitialized global variables (which default to
zero). Rather than expose ourselves to the blame for such bugs,
let's just leak the key.
VMware, Inc [Thu, 27 Oct 2011 18:40:36 +0000 (11:40 -0700)]
vmbackup: couple of fixes to Linux freeze ioctl support.
. The sync driver code may get EIO and EACCES when trying to freeze
filesystems. The first happens on our HGFS mount, if HGFS is not
enabled on the host. The second, if a user has some filesystem
mounted with "700" permissions, so our code can't access it.
Just ignore those cases and keep going, freezing what we can.
. The error handler wasn't properly unfreezing frozen filesystems,
resulting in potentially unusable VMs if something went wrong.
VMware, Inc [Thu, 27 Oct 2011 18:39:22 +0000 (11:39 -0700)]
Fix Windows VMCI/vSockets build.
The recent non-blocking change left out the extra "canBlock"
parameter from the Windows-specific code. It was also missing
the declaration for TryAcquire() and the definition of EAGAIN.
VMware, Inc [Thu, 27 Oct 2011 18:27:02 +0000 (11:27 -0700)]
Lower (process, i/o) priority when wiping disks on Win32.
An attempt to avoid warnings popping up about applications that become
unresponsive because we're hogging resources by writing lots of stuff
to the disk.
Also be less chatty with the backdoor, and fix a bug where we were passing
the wrong parameters to the RPCI call making the VMX respond with a
failure.
VMware, Inc [Thu, 27 Oct 2011 18:26:39 +0000 (11:26 -0700)]
Update network manager calls in suspend / resume scripts.
Another NetworkManager release, another API breakage... sigh. NM 0.8
added a new method ("Enable") but still had the "Sleep" one according
to the docs; 0.9 (used in Ubuntu 11.10) doesn't respond to "Sleep".
So add a call to the new method. Also try the new methods first.
On top of that, Ubuntu 11.10 freaks out if you call "/etc/init.d/networking
stop", and to make it worse "/etc/init.d/networking start" doesn't work at
all. So, when the NetworkManager call works, just don't do anything else.
This is "best effort" anyway, applications should be resilient to network
fluctuations (and we all live in a perfect world where pink unicorns roam
free).
VMware, Inc [Thu, 27 Oct 2011 18:22:23 +0000 (11:22 -0700)]
open-vm-tools: minor adjustments for uClibc.
Mostly based on patch submitted by Wallace Wadge (SF Bug 3371547). Also
added some autoconf trickery to disable our printf wrappers; now they're
only compiled for Linux systems that have "ecvt()" (uClibc doesn't have
that). This prevents compiling the wrappers on Solaris and FreeBSD (which
was useless), and makes the code compile on uClibc (also fixing SF Bug 3026491).
uClibc seems tricky, though; depending on how the library is compiled
it won't work. I tried Alpine Linux, and it doesn't ship with uClibc
locale support, so codesetOld.c fails to compile. I added a hack to
work around the issue (not included here) and everything else compiled,
and vmtoolsd seemed to run happily.
VMware, Inc [Thu, 27 Oct 2011 18:20:15 +0000 (11:20 -0700)]
Allow changing vmxnet2's MAC address while the interface is up
There is nothing in the device backend which prohibits us from
changing the MAC address of the vmxnet2 vNIC while the interface
is up and running. This patch allows the same from guest driver.
Thus vmxnet2 is comparable to vmxnet3 and e1000 behavior in this
regard.
VMware, Inc [Thu, 27 Oct 2011 18:19:45 +0000 (11:19 -0700)]
Fix QPair wakeup on suspend
On vmkernel, we do not unregister the guest memory, when a VM
is quiesced, so the queue pairs stay in a *_MEM state, if
already there. When detaching from a queue pair, we were only
waking up blocked kernel endpoints, if the queue pair was in
the *_NO_MEM state, since that would indicate that the QP is
quiesced. However, what we need to determine is whether the
queue pair headers are still mapped, since that is the common
operation for hosted and vmkernel on quiesce/unquiesce.
VMware, Inc [Thu, 27 Oct 2011 18:17:53 +0000 (11:17 -0700)]
ListProcessesInGuest Cleanup for ALL OS-es.
Cleaning up memory leaks in error conditions.
Re-structuring Process List to be an array of *new* Process Info
structures, one per process. Affects ALL OS-es.
VMware, Inc [Thu, 27 Oct 2011 17:57:19 +0000 (10:57 -0700)]
Implement HgfsGetRootDentry() to get the root dentry.
When the user loads vmhgfs modules and mounts a shared folder, kernel
crashes. During the intial hgfs mount process, we need a root dentry. We
can get the reference to the root dentry by calling d_alloc_root(). But
we cannot call d_alloc_root in HgfsReadSuper() since it requires a valid
inode which we don't have at that point of time. We implemented a
workaround for this issue. The workaround is done in two phases as
specified below:
- Create a dummy root dentry by calling d_alloc_name().
- Send a getAttr request to the hgfs server and get the root inode.
- Populate the content of the dummy root entry with the root inode.
This workaround works perfectly fine. But, with the latest kernel version,
the semantics of d_alloc_name() is changed. We can no longer pass NULL to
the d_alloc_name (which we have been doing till now). Fixed this by
implementing a new function HgfsGetRootDentry() that first gets the root
inode, fills the properties of the root inode and then uses d_alloc_root()
to generate the root dentry.
VMware, Inc [Thu, 27 Oct 2011 17:55:00 +0000 (10:55 -0700)]
Account for the space we're skipping when de-serializing input data.
This wouldn't cause a buffer overflow since the message layer
always adds a trailing null to the incoming data, but it could cause
invalid data to be parsed if the planets aligned correctly.
The locking for the VMCI queue pair broker was distributed
across the VMCI driver for the sole reason of being able to
handle a failed copy to user on Linux for queue pair
alloc. After this change, a failed copy to user will still
detach from an allocated queue pair, but a peer may have
attached to the queue pair between the alloc and detach. Since
the copy to user won't fail with a correctly working VMX, this
simplification is justified.
When the user executes any guest operation with invalid login
credentials, vmtoolsd process crashes [Signal 11, Segmentation fault].
Got the stack trace and found out that the crash happens in
Auth_AuthenticateUser() function. dlpam_strerror symbol is not loaded
from the PAM library but is referenced. This causes the crash.
Modified the code to import the dlpam_sterror symbol.
Code to determine is a PID is valid is tricky; we shouldn't have
multiple codes to do this. We happened to have a good, working code
for this in the file locking code. Move the code to lib/misc, adapt
it, slightly, to its new environment and then fix up the call sites.
vmblock: consolidate refcounting and freeing of block objects
Combine refcounting and memory management by providing
BlockGrabReferenec() and BlockDropReference() and have
BlockDropReference() free the block object once last reference
is dropped instead of callers explicitly checking refount
and freeing the object manually.
Make VMCI doorbell notification return VMCI_ERROR_NOT_FOUND
If a doorbell handle isn't found, we currently return
VMCI_ERROR_INVALID_ARGS. A more informative error code would
be VMCI_ERROR_NOT_FOUND, so let us do that instead.
Coverity complains a lot about using a pointer
after it has been freed.
Indeed, for certain conditions, the buffer
is being freed, but a pointer to it is not being
set to NULL.
And since this function is actually trying to duplicate
the functionality of realloc(), simplify it a bit and
get rid of the offending piece of code.
From realloc() documentation:
"
In case that ptr is NULL, the function behaves exactly
as malloc, assigning a new block of size bytes
and returning a pointer to the beginning of it.
In case that the size is 0, the memory previously
allocated in ptr is deallocated as if a call to free
was made, and a NULL pointer is returned.
"
This change makes the host code enforce that two VMs cannot
communicate via VMCI. Since the guest driver may be used on
older versions of our products, where VM to VM communication
is still allowed, we do not attempt to filter out VM to VM
communication in the guest.
Fix VMCIQueuePair_Alloc error on non-local peer for local QPs
VMCIQueuePair_Alloc will allow a local queue pair to be
allocated with a non-local peer ID. Instead, it should return
VMCI_ERROR_NO_ACCESS. This change fixes that.
Checked earlier verion of pam_unix2 (pam_unix2 1.30, and pam_modules-9 on sles 9),
as well the changelog, pam_unix2 never mentioned about shadow option support.