none
Kernel driver development - Remote debugging target machine (Hypervisor VM) with WinDbg RRS feed

  • Question

  • Hello,

    Trying to setup a debug environment to test a mini filter driver I'm working on.

    I've followed

    https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/setting-up-a-network-debugging-connection-automatically


    In my case I have my target hosted inside a VM which lives on my host machine. If I run kdnet on the target I get:

    c:\kdnet>kdnet

    Network debugging is supported by this Microsoft Hypervisor Virtual Machine.


    That doesn't quite match what was written in the docs page, but sounds positive.

    On my host machine I get the IP address of my host machine by running ipconfig /all

    Wireless LAN adapter Wi-Fi 2:

       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : TP-Link Wireless USB Adapter
       Physical Address. . . . . . . . . : 50-3E-AA-A0-0D-34
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       IPv6 Address. . . . . . . . . . . : 2601:600:897f:e0d8:b9ed:e667:c416:8067(Preferred)
       Temporary IPv6 Address. . . . . . : 2601:600:897f:e0d8:f03e:9270:ca18:a9fb(Deprecated)
       Temporary IPv6 Address. . . . . . : 2601:600:897f:e0d8:f484:3f37:2da8:5531(Preferred)
       Link-local IPv6 Address . . . . . : fe80::b9ed:e667:c416:8067%21(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.0.30(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Lease Obtained. . . . . . . . . . : Thursday, April 25, 2019 10:55:21 PM
       Lease Expires . . . . . . . . . . : Saturday, April 27, 2019 7:09:17 PM
       Default Gateway . . . . . . . . . : fe80::b27f:b9ff:fe79:4d7a%21
                                           192.168.0.1
       DHCP Server . . . . . . . . . . . : 192.168.0.1
       DHCPv6 IAID . . . . . . . . . . . : 676347562
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-7B-57-C8-94-DE-80-69-CC-BE
       DNS Servers . . . . . . . . . . . : 2001:558:feed::1
                                           2001:558:feed::2
                                           75.75.75.75
                                           75.75.76.76
                                           2001:558:feed::1
                                           2001:558:feed::2
       NetBIOS over Tcpip. . . . . . . . : Enabled

    Ethernet adapter vEthernet (Default Switch):

       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
       Physical Address. . . . . . . . . : B2-15-E4-6B-D7-30
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::24dd:2aa1:53a2:4085%23(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.164.209(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.240
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 397546980
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-7B-57-C8-94-DE-80-69-CC-BE
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled

    Looks like 192.168.164.209 is what I want.

    So now on the target I run

    kdnet.exe 192.168.164.209 50049

    It gives me back a command to run from my desktop machine which boots WinDbg opens a Kernel command window and hangs with

    Microsoft (R) Windows Debugger Version 10.0.18362.1 AMD64
    Copyright (c) Microsoft Corporation. All rights reserved.

    Using NET for debugging
    Opened WinSock 2.0
    Waiting to reconnect...

    I checked that WinDbg has been allowed through public and private networks in my firewall config.

    I further noticed I can sucessfully ping from the host to the target but not vice versa. So I went to the host's firewall inbound and enabled file and printer sharing echo request (any reason why I would not want this always enabled). Anyway that didn't help with connecting WinDbg

    Any help appreciated


    • Edited by T Morrison Sunday, April 28, 2019 10:50 PM corrected IP address
    Sunday, April 28, 2019 7:36 AM

All replies

  • Looks like 192.168.164.209 is what I want.

    So now on the target I run

    kdnet.exe 192.168.0.30 50049

    Isn't that inconsistent?

    Never did that manually (VS is working not to bad for me in this respect).
    Personally, I use network interface(s), referring to an 'Internal Network' switch (created with Virtual Switch Manager...), setting static (manual)  IP addresses on both Host and Target (same subnet, but subnet different to the one of Wi-Fi ). 
    (Host Target can ping each other).



    With kind regards
     

    Sunday, April 28, 2019 12:39 PM
  • Thanks for the response

    IP address was a copy/paste error it should 192.168.164.209 not 192.168.0.30.

    How is you target setup to use that switch? Do you configure a static IP inside target's win10 network settings?

    You mention you use VS. What version, I used 2019 and when I go to menu Extensions->Driver->Test->Device Configuration at the 2nd screen of the wizard I select provision, on the 3rd screen (provisioning with a green progress bar), VS always just crashes with no message (and does not automatically reboot).

    What version of windows are you targeting? I'm now worried I may not have the correct WDK installed. The docs talk of Windows 10 1903 but that hasn't been release yet. If I install the WDK for Win 10 1903 will that work for 1809? The docs really are not clear.

    Monday, April 29, 2019 12:09 AM
  • Sorry can not tell anything about VS 2019 and the new WDK, though would expect, that it will have some backward compatibility.
    I am using VS 2017 with WDK 10.0.17740.1000 from a Windows 1809 (17763.437) host and VM targets are old Windows 10 10240 builds.
    This states
    https://docs.microsoft.com/de-de/windows-hardware/drivers/gettingstarted/provision-a-target-computer-wdk-8-1
    provisioning does not work for VMs - so there may be problems with newer builds in this respect - my bad, should obviously re-read docu more often.

    Debugger connection with a Server 2016 eval (Windows Server 107 14393.693):
    Disabling Secure Boot for VM in Hyper V manager.
    Manually setting the ip for respective host and target interfaces, after adding network card to target (internal switch) - just for illustration would expect other address ranges also working.

    Interface on the target: 

    Ethernet adapter Ethernet 3:
       Connection-specific DNS Suffix  . :
       Link-local IPv6 Address . . . . . : fe80...
       IPv4 Address. . . . . . . . . . . : 11.11.11.11
       Subnet Mask . . . . . . . . . . . : 255.0.0.0
       Default Gateway . . . . . . . . . :

    Corresponding interface on the host: 

    Ethernet-Adapter vEthernet (DebugSwitch):
       Verbindungsspezifisches DNS-Suffix:
       Verbindungslokale IPv6-Adresse  . : fe80 ...
       IPv4-Adresse  . . . . . . . . . . : 11.11.11.12
       Subnetzmaske  . . . . . . . . . . : 255.0.0.0
       Standardgateway . . . . . . . . . :

    (Pinging is a problem ...)
    On target
    bcdedit /debug on
    bcdedit /dbgsettings net hostip:11.11.11.12 port:50001

    The corresponding Device Configuration in VS with key obtained from bcdedit

    'Manually configure debuggers and do not provision'

    then VS 'Debug->Attach to Process' 'Connection type: Windows Kernel Mode Debugger' is connecting without further complaints.

    With kind regards


    Monday, April 29, 2019 12:31 PM
  • Provisioning for driver deployment and testing with VS 2017 WDK on 'Server 2016' VM with above mentioned configuration also looks good at first glance (Driver Test Group Explorer):

    With kind regards
    Monday, April 29, 2019 2:58 PM