|
From: Mojiong Q. <mq...@vm...> - 2008-11-01 04:14:14
Attachments:
vmware_backdoor.patch
|
Hi guys, I used Valgrind to help debug programs in VMware virtual machines, and found Valgrind doesn't support the programs that communicates with VMM(Virtual Machine Monitor) through backdoor functions. One program I was debugging is "vmware-user" which is part of the vmware tools suite. The program is an agent running inside the guest OS. It helps user to perform drag-n-drop, mouse auto-focus, screen resolution change feature. When I run vmware-tools in Valgrind in a VM, the vmware-user process crashes with SIGSEGV (due to in/out), and SIGILL(due to ins/outs). But it works without Valgrind. So I wrote a patch to address the issue. The following is a description of the problem and how it is fixed. VMware backdoor is a communication mechanism between the guest OS/App and the VMM. This is similar to the client request mechanism in Valgrind. Both recognize client requests by looking for special instruciton sequences. The difference is that VMware backdoor communication is done by accessing a special I/O port (56568h) and setting pre-defined value (564D5868h) to EAX. The page (http://chitchat.at.infoseek.co.jp/vmware/backdoor.html) has some text. It talked about VMware backdoor through in/out, but not ins/outs, which are also used by VMware as backdoor triggering instrucitons. The problem is that VMware VMM extends in/out/ins/outs which meets backdoor conditions (special port and special EAX value) to take arbitrary registers as input and allow to write arbitrary registers as output. This is not compatible to current in/out dirtyhelpers in Valgrind. Another problem, Valgrind didn't handle ins/outs for now. The attached patch is against the last SVN snapshort of Valgrind at revision 8722. Roughly three changes: - Support ins/outs, rep ins/rep outs. Added corresponding decoding stub in VEX/priv/guest-x86(amd64)/toIR.c, and dirtyhelpers in ghelper.c; - Added a new function process_vmware_backdoor in ghelper.c. It is called in the dirtyhelpers for in, out, ins and outs; - Added code to process 8-bit memory chunk in memcheck/mc_translate.c/do_shadow_Dirty, because ins/outs produce 8-bit memory access. This patch benefits the programs that uses VMware backdoor. It is true that only a small number of programs that actually uses VMware backdoor. But since this change is a low impact extension to valgrind's in/out/ins/outs instruction handling; it does not have performance impact to the programs that do not use these instructions; and it is a big convenience to these developers of vmware tools, it would be nice to include this change in the upstream. It would be great if you can take a look at the patch and possibly merged it into Valgrind. Thanks, Mojiong |
|
From: Nicholas N. <nj...@cs...> - 2008-11-01 10:09:30
|
On Sat, 1 Nov 2008, Mojiong Qiu wrote: > Hi guys, > > I used Valgrind to help debug programs in VMware virtual machines, and > found Valgrind doesn't support the programs that communicates with > VMM(Virtual Machine Monitor) through backdoor functions. One program I was > debugging is "vmware-user" which is part of the vmware tools suite. The > program is an agent running inside the guest OS. It helps user to perform > drag-n-drop, mouse auto-focus, screen resolution change feature. You posted a patch on Oct 23, is this one different? Nick |
|
From: Min Xu (Hsu) <mi...@vm...> - 2008-11-01 19:35:31
|
Hi Nicholas, Sorry for the confusion. Mojiong and I have improved the description of the patch so that people can review it with sufficient background information. Comparing with last patch, this patch has some cosmetic improvements and it was generated against the head of SVN revision, instead of 3.3.1. thanks, min On Sat, 01 Nov 2008 Nicholas Nethercote wrote : > On Sat, 1 Nov 2008, Mojiong Qiu wrote: > > > Hi guys, > > > > I used Valgrind to help debug programs in VMware virtual machines, and > > found Valgrind doesn't support the programs that communicates with > > VMM(Virtual Machine Monitor) through backdoor functions. One program I was > > debugging is "vmware-user" which is part of the vmware tools suite. The > > program is an agent running inside the guest OS. It helps user to perform > > drag-n-drop, mouse auto-focus, screen resolution change feature. > > You posted a patch on Oct 23, is this one different? > > Nick > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |