VMware, Inc [Mon, 20 Dec 2010 21:42:42 +0000 (13:42 -0800)]
Undo HGFS memory leak fix.
It seems to cause issues with registering apps. I'll let the HGFS guys fix
the leak as part of cleaning up this channel registration code (bug 638446).
VMware, Inc [Mon, 20 Dec 2010 21:41:51 +0000 (13:41 -0800)]
vmtoolsd: introduce service properties.
Service properties are a way for plugins to share data without having
link-time dependencies. A plugin can export a property in vmtoolsd's
service object (the same object used currently to send signals), and
that property can be retrieved at any time. Thanks to GObject's property
system, there's also notification of changes, using glib signals.
The properties are not ref counted by the service, so plugins need to agree
on the lifecycle of the property for things to work safely.
Extra: fix an issue in pluginMgr.c where invalid memory was being used
after an array reallocation.
VMware, Inc [Mon, 20 Dec 2010 21:36:21 +0000 (13:36 -0800)]
Fix vsock connect on listening socket
A switch statement in Linux vsock was having a case outside
the enum value range. On closer examination, we are testing
for a value, that is never set. I verified that calling
connect on socket in the listen case will fall through and hit
the default case, since sock->state is still in the
SS_UNCONNECTED state but sk->sk_state is SS_LISTEN. Looking at
other protocol implementations, sk->sk_state is used for the
procotol specific state, so this change simply catches the
SS_LISTEN state in the default case entry, instead of trying
to assign SS_LISTEN to the sock->state when the socket is put
in listening state.
VMware, Inc [Thu, 18 Nov 2010 22:56:00 +0000 (14:56 -0800)]
fix guestd crashes when Solaris GOS has vlan/vmxnet3 nic configured.
For the vlan/vmxnet3 interface, libdnet return its link address type as ADDR_TYPE_NONE
and addr_ntoa converts it to NULL, which causes crash in ReadInterfaceDetails().
VMware, Inc [Thu, 18 Nov 2010 22:54:52 +0000 (14:54 -0800)]
Fix minor memory leaks.
. release a reference to a timeout source so it's properly freed.
. in the HGFS channel handling code, only initialize the channel's
connection once, since the channel is a static struct. This avoid
allocating a second transport-specific connection object (in the
init() callback) which would then be leaked.
Note that the HGFS fix is, for now, just a fix for the leak. There
are more issues with the static channel approach and the current code: for
example, the first app calling HgfsServerManager_Unregister() will shut
down the channel, instead of the last one, since the channel itself is not
ref counted.
VMware, Inc [Thu, 18 Nov 2010 22:54:11 +0000 (14:54 -0800)]
lib/lock: clarify how condVars work
MXUser condVar waits may return before the condition is signaled
or an explicit timeout occurs due to spurious wakeups. Make this
clear in the requirements and code itself. Fix the one place where
there was a dependency on the old implementation.
VMware, Inc [Thu, 18 Nov 2010 22:42:05 +0000 (14:42 -0800)]
Unity/X11: Initialize host:guest desktop mappings before use.
As written there existed a race between entering Unity and receipt
of the host's desired desktop layout such that certain guest X11
events lead to accessing random, uninitialized memory and consequently
receiving ye olde SIGSEGV.
This change works around the issue* by initializing the host:guest
virtual desktop maps based on the guest's current configuration. That
is, if the guest had 8 desktops, we'll just create an identity mapping
of 8 desktops where desktop 0 in the guest is desktop 0 in the host,
guest1 = host1, and so on.
* Other things should be considered more fully later, such as not even
registering for events until the host UI issues -ALL- initialization
RPCs.
VMware, Inc [Thu, 18 Nov 2010 22:37:39 +0000 (14:37 -0800)]
vmtoolsd: relax VMware hypervisor restriction.
Allow vmtoolsd to run anywhere if not running one of the known Tools
services, or running in debug mode. Also ignore the plugin path not
existing if running in debug mode (so that we can easily run with just
a debug plugin driving everything).
This makes it easier to run vmtoolsd under valgrind, since valgrind
doesn't emulate our backdoor and the code always thinks we're not
running on VMware.
VMware, Inc [Thu, 18 Nov 2010 22:33:03 +0000 (14:33 -0800)]
Introduce VMCI Events for guest memory access
For VMCI users in the vmx, we know generate events when access
to the guest memory changes, i.e., when bus mastering is
enabled/disabled. These events are available through the same
API as the VMCI Event API which is part of the VMCI kernel
API. The events are delivered synchronously, such that actions
can be taken at the point where memory access is
disabled/enabled. The events are delivered with the VMCI
device lock held - the same way that VMCI datagrams are
delivered, so any code that can run in a datagram callback
should be able to run in the event callback as well.
For HGFS, using VMCIEvent_Subscribe during initialization to
subscribe to the event VMCI_EVENT_MEM_ACCESS_OFF will provide
a synchronous callback to the HGFS vmx module whenever the
guest is soft reset or the VMCI driver is unloaded.
VMware, Inc [Thu, 18 Nov 2010 22:16:50 +0000 (14:16 -0800)]
Move kmap outside of critical section in VMCIHost_GetUserMemory
While calling get_user_pages, we grab
current->mm->mmap_sem. However, we do not need to hold on to
it while doing kmap, and since kmap may sleep, it seems like a
genuinely bad idea.
VMware, Inc [Thu, 18 Nov 2010 22:16:06 +0000 (14:16 -0800)]
Bring comments in backdoor_def.h up to date.
Some of the backdoor commands have been commented in backdoor_def.h
indicating if they are devel only or if they are now unused. I went
through the whole list and udpated the comments to match the current
code. (I also lined up the numbers.) No functional change.
VMware, Inc [Thu, 18 Nov 2010 22:12:13 +0000 (14:12 -0800)]
Don't unregister capabilities if they were never set.
This avoid an issue where a second instance of vmtoolsd would fail to claim
the RPC channel to communicate with the VMX, shut down, and unregister all
capabilities in the process, which would overwrite the state set by the
existing instance of vmtoolsd.
VMware, Inc [Thu, 18 Nov 2010 22:07:48 +0000 (14:07 -0800)]
Move VMCI socket to connected state before sending attach
During VMCI Stream socket connect on Linux, the server side
sends an attach message before adding the pending socket to
the list of connected sockets. External control messages,e.g.,
a WROTE message, triggered by the attach message may arrive
and not find the (previously pending) socket in the list of
connected sockets, and therefore will direct the control
message to the parent socket which is still in the listening
state. In the case of READ/WROTE messages, this will cause the
listening socket to respond with a RST message.
The solution is to add the pending socket to the connected
socket list before sending attach message, since that will
queue incoming packets for the right socket.
VMware, Inc [Thu, 18 Nov 2010 22:05:09 +0000 (14:05 -0800)]
Unity/X11: Hack/convert from C to C++.
With the introduction of WindowPathFactory, the core Unity/X11 needs
to grok C++. Here's a change that does that by renaming a bunch of
files followed by signedness and typecasting fixes.
VMware, Inc [Thu, 18 Nov 2010 22:04:15 +0000 (14:04 -0800)]
GHI/X11: Add fixed menu item monitors.
This change adds a Gio::FileMonitor to watch over $HOME/.gtk-bookmarks
and connects a slot to Gtk::RecentMgr::signal_changed() to watch for
updates to the recent documents menu.
When an update is detected, the existing relevant submenu is purged
and repopulated. Then the MenuItemManager emits its menusChanged
signal, alerting the GHI platform code of the change.
VMware, Inc [Thu, 18 Nov 2010 22:03:34 +0000 (14:03 -0800)]
GHI/X11: Move "DetectDesktopEnv" to lib/xdg.
This takes the static deskeop environment detection logic out of lib/
ghIntegration and places it a shell script and wrapper in lib/xdg.
We'll now distribute with Tools a vmware-xdg-detect-de which contains
the "detectDE" routine used in many of Portland's xdg-* scripts.
Keeping this logic in a script has a few motivations:
1. No D-Bus (or similar) dependency added to library code.
2. Allows users to hack as time goes on in case any of the methods
currently employed stop working.
VMware, Inc [Thu, 18 Nov 2010 21:53:48 +0000 (13:53 -0800)]
GHI/X11: Fork, reinitialize environment when spawning applications.
Okay, new school GHI leaves a lot of heavy lifting to GLib, because
GLib is awesome. Unfortunately, its GAppInfo launch handler,
g_app_info_launch, is slightly less awesome in that it doesn't take
an environment vector as an argument. That makes me sad.
To work around this, I whipped up a wrapper function which does the
following:
- fork()
- reinitialize the environment using clearenv and putenv*
- g_app_info_launch
- Child exits 0 upon success, non-zero on failure.
- Parent blocks until child exits, using child's exit status to
determine success or failure.
* Sort of dirty, but it saves me a parsing step, since nativeEnviron
is composed of strings of key=val, and that's the format accepted by
putenv. Conversely setenv takes the variable and value strings
separately.
I'm going to file a feature request bug against GIO and provide some
patches. If accepted upstream, we'll be able to get rid of this
function.
VMware, Inc [Thu, 18 Nov 2010 21:51:55 +0000 (13:51 -0800)]
lib/file: File_Rename becomes File_Move
The File_Rename function is really the equivalent of the
unix/Linux "mv" command - it may atomically rename or copy the
file. Unfortunately there is no nice way to know what actually
happened, as cleanup may be necessary upon failure. Fix this.
While we're at it, make the GetLastError/errno make sense.
VMware, Inc [Thu, 18 Nov 2010 21:50:06 +0000 (13:50 -0800)]
Unity: Fix SetDesktopConfig handling.
The work which factored TCLO handling out of lib/unity introduced a
regression whereby Unity_SetDesktopConfig no longer updated the
unity.virtDesktopArray state variable. This caused all subsequent
calls relating to virtual desktops, Unity_SetDesktopActive and
Unity_SetWindowDesktop, to fail.
VMware, Inc [Thu, 18 Nov 2010 21:42:27 +0000 (13:42 -0800)]
lib/lock: ASSERTION failure during histogram collection
When the acquisition or held time is *EXACTLY* 10 seconds, expressed
in nanoseconds, the MXUser histogram collection code ASSERTs. A
bound check wasn't quite right.
VMware, Inc [Thu, 18 Nov 2010 21:39:23 +0000 (13:39 -0800)]
Unref the default glib context when quitting.
After some digging, I found out why valgrind was complaining about
memory leaks: creating a main loop using the default glib GMainContext
creates an implicit reference to that context, that needs to be properly
freed. This way, all GSources attached to that context are properly
destroyed.
VMware, Inc [Thu, 18 Nov 2010 21:29:15 +0000 (13:29 -0800)]
Unity/X11: Initialize fakeEvent before passing off for processing.
From bug 626112 update 8:
"During init when querying all windows, Unity/X11 enumerates all
windows' properties and passes the properties down to the property
event handler via fake property events. Without initializing to 0,
fakeEvent.xproperty.state may be set to "PropertyDelete", so code
lower in the stack may mistakenly think that windows' initial
properties are actually *removed* properties."
VMware, Inc [Thu, 18 Nov 2010 21:27:25 +0000 (13:27 -0800)]
lib/lock: provide full control of statistics
Allow the MXUser_Control functions to fully enable statistics on
exclusive, recursive and RW locks. This allows a developer to
enable statistics on a lock by lock basis should a study warrant it.
VMware, Inc [Thu, 18 Nov 2010 21:22:40 +0000 (13:22 -0800)]
Hgfs Over VMCI - Mac OSX. Synchronous.
This is resubmission of change that was backed out.
I have changed mostly channel switching logic that was broken. Now
we store the channel in every request so that we call free/allocate/send
of the same channel when global hgfs channel resets to some different
channel.