VMKD is a program that provides high speed kernel debugging support for VMware virtual machines. VMKD allows you to debug a VMware VM in a high speed fashion, instead of using the much slower and lower bandwidth virtual serial port mechanism.
This page documents the general usage and installation of VMKD. There is, however, a post series with in-depth coverage of how VMKD works “under the hood” if you are interested in the implementation details of VMKD.
When you use VMKD to debug a VM, VMKD creates a named pipe on the machine hosting the VM that you can connect to using the usual kernel debugging over named pipe support in WinDbg. However, unlike conventional VM kernel debugging, which is done by creating a virtual serial port in the VM and exposing it to the host system as a named pipe, VMKD does not internally use a virtual serial port to communicate with the kernel running in the VM. Instead, VMKD uses a high speed interface that takes advantage of the fact that the kernel is running in a VM to enhance the performance and responsiveness of the kernel debugging experience.
VMKD has presently only been tested against VMware Server 1.0.3 and 1.0.4. It is designed in a fashion that is intended to be portable to future VMware versions, however this forwards compatibility is fairly fragile and may break on future releases. VMKD does not support Microsoft Virtual Server or other virtualization products. Do not attempt to use VMKD with other virtualization programs or with a physical machine.
The main benefits of using VMKD instead of conventional serial port debugging are:
However, VMKD is not perfect. Because it was written without the assistance of either VMware or Microsoft, integration with the Windows kernel and VMware is a bit rough around the edges. Due to this, there are some steps that need to be followed to use VMKD. For some kernel debugging tasks, it may simply be easier to just use virtual serial port debugging and live with the limitations of the virtual serial port than to set up a VMKD debugging session.
Additionally, VMKD is experimental software. Although I have attempted to test it on common configurations, it is possible that you may encounter bugs that may crash your KD target VM, or even the vmware-vmx.exe process that you are using to host the target VM.
In order to use VMKD, you will need to do the following:
The final binary included is kdvmware.sys (x86 and x64 flavors), which is a driver that needs to be installed in the guest operating system.
sc create kdvmware type= kernel start= demand binPath= c:/windows/system32/drivers/kdvmware.sys DisplayName= kdvmware
(c:/windows/system32/drivers/kdvmware.sys corresponds to the location where you have placed kdvmware.sys on the target VM). Do not start the driver service yet. I recommend leaving the driver service as manual start, as it will attempt to establish communications with vmxpatch.dll host-side and assume control of the kernel debugging interface as soon as the driver is started.
If you are not certain what vmware-vmx.exe instance corresponds to the VM that you want to kernel debug, then I recommend using a tool such as Process Explorer or WinDbg to examine either the command line or current directory of each vmware-vmx.exe process until you find one that references the directory containing the VM you want to debug.
If the driver successfully loads (and you do not get an error from trying to start the driver, such as by “net start kdvmware”), then it has successfully established communications with vmxpatch.dll on the host.
You should be able to use the built in debugger named pipe support to communicate with the VM using the VMKD named pipe, just the same as you would with a virtual serial port named pipe. Make sure that you connect to the VMKD named pipe and not the virtual serial port named pipe, as the kernel in the VM will no longer be receiving data from the virtual serial port.
For subsequent uses of VMKD, you will just need to use vmxinject.exe to load vmxpatch.dll into the correct vmware-vmx.exe instance and then from there, start the kdvmware driver service once you are ready to cut kernel debugging for the VM over to VMKD.
Note that on x64 systems, it may be necessary to disable driver signature enforcement to load the kdvmware.sys driver. Additionally, on x64 systems, it will be necessary to disable PatchGuard to use kdvmware.sys (the kdvmware driver rewrites the active kernel debugger protocol module, which is unfortunately protected by PatchGuard). This can be accomplished by attaching a debugger to the virtual serial port at boot time so that PatchGuard is not enabled, and then after boot cutting the system over to VMKD. Due to these limitations, it is typically more convenient to use VMKD on 32-bit VMs.
The vmxpatch.dll module that is loaded into the vmware-vmx.exe process has various debug prints enabled in this release, which will be activated if a debugger is active in the vmware-vmx.exe process. If you experience difficulties while trying to connect to the VMKD named pipe and synchronize with the target kernel, try attaching a debugger to the vmware-vmx.exe process and examining the debug output. Additionally, you can enable DbgEng KD protocol debugging with the Ctrl-D key combination (Ctrl-Alt-D for WinDbg). Keep in mind that watching vmxpatch.dll debug output with a debugger attached to vmware-vmx.exe will significantly lower both the throughput and responsiveness of the VMKD connection.
From:http://www.nynaeve.net/?page_id=168