cezanne / usbip-win

USB/IP for Windows
GNU General Public License v3.0
1.98k stars 350 forks source link

windows Client attach Linux Server(BSOD) #194

Closed andy010106 closed 3 years ago

andy010106 commented 4 years ago

Hi cezanne,

I am using your code in windows10 as USBIP client(0.1.0) Linux install from kernel for USBIP server . Linux server bind USB device OK Linux server listening OK windows client attach face two random problem(Linux server usbipd.exe show device connect complete): 1.BSOD 2.after windows client attach for 5~10 seconds, it will stop attach event and close the usbip.exe.

Here is the BSOD Dump message:

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

Loading Dump File [C:\Windows\Minidump\082020-23218-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is: srv*
Executable search path is: 
Windows 10 Kernel Version 18362 MP (4 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS
Built by: 18362.1.amd64fre.19h1_release.190318-1202
Machine Name:
Kernel base = 0xfffff802`56000000 PsLoadedModuleList = 0xfffff802`564480f0
Debug session time: Thu Aug 20 03:41:43.399 2020 (UTC - 5:00)
System Uptime: 0 days 0:24:59.258
Loading Kernel Symbols
...............................................................
................................................................
................................................................
...............................
Loading User Symbols
Loading unloaded module list
.................
For analysis of this file, run !analyze -v
3: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced.  This cannot be protected by try-except.
Typically the address is just plain bad or it is pointing at freed memory.
Arguments:
Arg1: ffff96071c11d000, memory referenced.
Arg2: 0000000000000000, value 0 = read operation, 1 = write operation.
Arg3: fffff802722b4f2d, If non-zero, the instruction address which referenced the bad memory
    address.
Arg4: 0000000000000002, (reserved)

Debugging Details:
------------------

*** WARNING: Unable to verify timestamp for usbip_vhci.sys

Could not read faulting driver name

KEY_VALUES_STRING: 1

    Key  : Analysis.CPU.Sec
    Value: 7

    Key  : Analysis.DebugAnalysisProvider.CPP
    Value: Create: 8007007e on DESKTOP-GA1HIIK

    Key  : Analysis.DebugData
    Value: CreateObject

    Key  : Analysis.DebugModel
    Value: CreateObject

    Key  : Analysis.Elapsed.Sec
    Value: 46

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 99

    Key  : Analysis.System
    Value: CreateObject

BUGCHECK_CODE:  50

BUGCHECK_P1: ffff96071c11d000

BUGCHECK_P2: 0

BUGCHECK_P3: fffff802722b4f2d

BUGCHECK_P4: 2

READ_ADDRESS: fffff802565733b8: Unable to get MiVisibleState
Unable to get NonPagedPoolStart
Unable to get NonPagedPoolEnd
Unable to get PagedPoolStart
Unable to get PagedPoolEnd
fffff8025642a3b8: Unable to get Flags value from nt!KdVersionBlock
fffff8025642a3b8: Unable to get Flags value from nt!KdVersionBlock
unable to get nt!MmSpecialPagesInUse
 ffff96071c11d000 

MM_INTERNAL_CODE:  2

BLACKBOXBSD: 1 (!blackboxbsd)

BLACKBOXNTFS: 1 (!blackboxntfs)

BLACKBOXPNP: 1 (!blackboxpnp)

BLACKBOXWINLOGON: 1

CUSTOMER_CRASH_COUNT:  1

PROCESS_NAME:  usbip.exe

TRAP_FRAME:  ffff888ce72783c0 -- (.trap 0xffff888ce72783c0)
NOTE: The trap frame does not contain all registers.
Some register values may be zeroed or incorrect.
rax=0000000000004000 rbx=0000000000000000 rcx=0000000000002cf0
rdx=0000000000000010 rsi=0000000000000000 rdi=0000000000000000
rip=fffff802722b4f2d rsp=ffff888ce7278550 rbp=0000000000000001
 r8=0000000000004000  r9=ffff96071c11bcf0 r10=0000000000000000
r11=ffff888ce7278688 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei ng nz na po nc
usbip_vhci+0x4f2d:
fffff802`722b4f2d f3a4            rep movs byte ptr [rdi],byte ptr [rsi]
Resetting default scope

STACK_TEXT:  
ffff888c`e7278118 fffff802`561ecf1a : 00000000`00000050 ffff9607`1c11d000 00000000`00000000 ffff888c`e72783c0 : nt!KeBugCheckEx
ffff888c`e7278120 fffff802`5605875f : 0000005f`25f7ed30 00000000`00000000 00000000`00000000 ffff9607`1c11d000 : nt!MiSystemFault+0x1c5aba
ffff888c`e7278220 fffff802`561d041e : 00000000`00000000 00000000`00000000 00000000`00000001 00000000`00000000 : nt!MmAccessFault+0x34f
ffff888c`e72783c0 fffff802`722b4f2d : ffffa780`d28d2000 ffff9607`13d8b0d0 00000000`00000000 fffff802`722b246f : nt!KiPageFault+0x35e
ffff888c`e7278550 ffffa780`d28d2000 : ffff9607`13d8b0d0 00000000`00000000 fffff802`722b246f 00000000`00000000 : usbip_vhci+0x4f2d
ffff888c`e7278558 ffff9607`13d8b0d0 : 00000000`00000000 fffff802`722b246f 00000000`00000000 00000000`00000000 : 0xffffa780`d28d2000
ffff888c`e7278560 00000000`00000000 : fffff802`722b246f 00000000`00000000 00000000`00000000 ffffa780`d28d2000 : 0xffff9607`13d8b0d0

SYMBOL_NAME:  usbip_vhci+4f2d

MODULE_NAME: usbip_vhci

IMAGE_NAME:  usbip_vhci.sys

STACK_COMMAND:  .thread ; .cxr ; kb

BUCKET_ID_FUNC_OFFSET:  4f2d

FAILURE_BUCKET_ID:  AV_R_INVALID_usbip_vhci!unknown_function

OS_VERSION:  10.0.18362.1

BUILDLAB_STR:  19h1_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

FAILURE_ID_HASH:  {1c5b19a2-ed00-161e-a44e-3791422c08ab}

Followup:     MachineOwner
Wqrld commented 4 years ago

Try using 3.0 UDE, that works fine for me on windows 10 18362 19h1

andy010106 commented 4 years ago

Thanks for your opinion. After listening your opinion,I tried 3.0 UDE as Windows Client then attach again. It appears another bug. It seems it found the remote USB device,but Client can not recognize the USB device. I have already plugin my USB to local client ,it can work normally. I think it maybe not my windows Client cannot use my USB device. But after attach it cannot recognize. Here is the following pop up message:

USB device not recognize The last USB you connected to your computer malfunctioned and Windows does not recognize it. Recommendation Try reconnecting the device.If Windows still does not recognize it,your device may not be working properly.

TheMohawkNinja commented 4 years ago

Hello,

I am using the current 0.3.0 kmdf ude release and have also experienced a BSOD while attaching a keyboard and mouse from a remote Linux machine.

Please see below minidump.


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

Loading Dump File [C:\Windows\Minidump\102820-8093-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

************* Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*
Symbol search path is: srv*
Executable search path is: 
Windows 10 Kernel Version 18362 MP (16 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS
Edition build lab: 18362.1.amd64fre.19h1_release.190318-1202
Machine Name:
Kernel base = 0xfffff800`4d200000 PsLoadedModuleList = 0xfffff800`4d6461b0
Debug session time: Wed Oct 28 15:33:01.909 2020 (UTC - 5:00)
System Uptime: 0 days 6:12:04.885
Loading Kernel Symbols
...............................................................
................................................................
................................................................
................................
Loading User Symbols
Loading unloaded module list
............
For analysis of this file, run !analyze -v
nt!KeBugCheckEx:
fffff800`4d3c2ce0 48894c2408      mov     qword ptr [rsp+8],rcx ss:0018:ffff8789`ba763a90=000000000000000a
10: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

IRQL_NOT_LESS_OR_EQUAL (a)
An attempt was made to access a pageable (or completely invalid) address at an
interrupt request level (IRQL) that is too high.  This is usually
caused by drivers using improper addresses.
If a kernel debugger is available get the stack backtrace.
Arguments:
Arg1: ffffb404b122d388, memory referenced
Arg2: 0000000000000002, IRQL
Arg3: 0000000000000000, bitfield :
    bit 0 : value 0 = read operation, 1 = write operation
    bit 3 : value 0 = not an execute operation, 1 = execute operation (only on chips which support this level of status)
Arg4: fffff8004d260b62, address which referenced memory

Debugging Details:
------------------

*** WARNING: Unable to verify timestamp for udecx.sys
*** WARNING: Unable to verify checksum for win32k.sys

KEY_VALUES_STRING: 1

    Key  : Analysis.CPU.mSec
    Value: 6405

    Key  : Analysis.DebugAnalysisProvider.CPP
    Value: Create: 8007007e on BENPC

    Key  : Analysis.DebugData
    Value: CreateObject

    Key  : Analysis.DebugModel
    Value: CreateObject

    Key  : Analysis.Elapsed.mSec
    Value: 15298

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 93

    Key  : Analysis.System
    Value: CreateObject

    Key  : WER.OS.Branch
    Value: 19h1_release

    Key  : WER.OS.Timestamp
    Value: 2019-03-18T12:02:00Z

    Key  : WER.OS.Version
    Value: 10.0.18362.1

ADDITIONAL_XML: 1

OS_BUILD_LAYERS: 1

BUGCHECK_CODE:  a

BUGCHECK_P1: ffffb404b122d388

BUGCHECK_P2: 2

BUGCHECK_P3: 0

BUGCHECK_P4: fffff8004d260b62

READ_ADDRESS: fffff8004d7713b8: Unable to get MiVisibleState
Unable to get NonPagedPoolStart
Unable to get NonPagedPoolEnd
Unable to get PagedPoolStart
Unable to get PagedPoolEnd
fffff8004d6283b8: Unable to get Flags value from nt!KdVersionBlock
fffff8004d6283b8: Unable to get Flags value from nt!KdVersionBlock
unable to get nt!MmSpecialPagesInUse
 ffffb404b122d388 

BLACKBOXBSD: 1 (!blackboxbsd)

BLACKBOXNTFS: 1 (!blackboxntfs)

BLACKBOXPNP: 1 (!blackboxpnp)

BLACKBOXWINLOGON: 1

CUSTOMER_CRASH_COUNT:  1

PROCESS_NAME:  usbip.exe

TRAP_FRAME:  ffff8789ba763bd0 -- (.trap 0xffff8789ba763bd0)
NOTE: The trap frame does not contain all registers.
Some register values may be zeroed or incorrect.
rax=ffffb4039fe42240 rbx=0000000000000000 rcx=ffffb404b122d388
rdx=ffffb403b122d388 rsi=0000000000000000 rdi=0000000000000000
rip=fffff8004d260b62 rsp=ffff8789ba763d60 rbp=0000000000000000
 r8=0000000000000002  r9=0000000000000000 r10=0000000000000001
r11=fffff780000003b0 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei pl zr na po nc
nt!KeReleaseMutant+0x142:
fffff800`4d260b62 483901          cmp     qword ptr [rcx],rax ds:ffffb404`b122d388=????????????????
Resetting default scope

STACK_TEXT:  
ffff8789`ba763a88 fffff800`4d3d4b29     : 00000000`0000000a ffffb404`b122d388 00000000`00000002 00000000`00000000 : nt!KeBugCheckEx
ffff8789`ba763a90 fffff800`4d3d0e69     : ffffb403`97010340 ffffb403`97010800 ffffb403`97015f00 000000b0`00000030 : nt!KiBugCheckDispatch+0x69
ffff8789`ba763bd0 fffff800`4d260b62     : 00000000`00000002 ffffb403`aa8ff860 0000010f`b2af0900 00004bfc`57070200 : nt!KiPageFault+0x469
ffff8789`ba763d60 fffff800`4d260d93     : ffffb403`00000000 ffffb403`00000001 ffffb403`00000001 ffffb403`9fe42100 : nt!KeReleaseMutant+0x142
ffff8789`ba763e50 fffff800`5de211b9     : ffffb403`9fe42228 fffff800`00000000 ffffb403`00000000 fffff800`5de03c00 : nt!KeReleaseMutex+0x13
ffff8789`ba763e80 ffffb403`9fe42228     : fffff800`00000000 ffffb403`00000000 fffff800`5de03c00 ffff8789`00000002 : pmon+0x11b9
ffff8789`ba763e88 fffff800`00000000     : ffffb403`00000000 fffff800`5de03c00 ffff8789`00000002 fffff800`5dcb23e2 : 0xffffb403`9fe42228
ffff8789`ba763e90 ffffb403`00000000     : fffff800`5de03c00 ffff8789`00000002 fffff800`5dcb23e2 ffffb403`9fe421a0 : 0xfffff800`00000000
ffff8789`ba763e98 fffff800`5de03c00     : ffff8789`00000002 fffff800`5dcb23e2 ffffb403`9fe421a0 fffff800`5de210cd : 0xffffb403`00000000
ffff8789`ba763ea0 fffff800`5de03abc     : 00000000`00000002 ffff8789`ba763f58 ffffb403`a6d2b910 ffffb403`ad9e9960 : mouhid!MouHid_StartRead+0x84
ffff8789`ba763f00 fffff800`4d25bd99     : 00000000`00000000 00000000`00000000 00000000`c0000201 00000000`00000000 : mouhid!MouHid_ReadComplete+0x75c
ffff8789`ba763fa0 fffff800`4d25bc67     : ffffb403`b2b229f0 00000000`00000006 00000000`00000000 ffffb403`a1550660 : nt!IopfCompleteRequest+0x119
ffff8789`ba7640b0 fffff800`5dc7acb1     : ffffb403`b2b229e0 ffffb403`b2b22902 ffff8789`ba764151 00000000`00000005 : nt!IofCompleteRequest+0x17
ffff8789`ba7640e0 fffff800`5dc7a7ba     : ffffb403`a1550660 ffffb403`a1550602 ffffb403`b13f7ab0 00000000`00000005 : HIDCLASS!HidpDistributeInterruptReport+0x25d
ffff8789`ba7641b0 fffff800`4d25bd99     : ffffb403`ae5da010 ffffb403`ae5da010 ffff8789`ba764201 ffffb403`ae5da323 : HIDCLASS!HidpInterruptReadComplete+0x34a
ffff8789`ba764250 fffff800`4d25bc67     : 00000000`00000000 00000000`00000000 00000000`00000001 00000000`00000001 : nt!IopfCompleteRequest+0x119
ffff8789`ba764360 fffff800`505a84ad     : 00000000`00000000 ffffb403`b1993df0 00000000`00000002 00000000`00000000 : nt!IofCompleteRequest+0x17
ffff8789`ba764390 fffff800`505a7f7b     : ffffb403`adcfb302 00000000`00000000 ffffb403`ae5da010 00000000`00000000 : Wdf01000!FxRequest::CompleteInternal+0x22d [minkernel\wdf\framework\shared\core\fxrequest.cpp @ 869] 
ffff8789`ba764420 fffff800`5db491d0     : 00000000`00000000 ffffb403`b1993df0 00004bfc`4e66f688 00004bfc`4e66c208 : Wdf01000!imp_WdfRequestComplete+0x8b [minkernel\wdf\framework\shared\core\fxrequestapi.cpp @ 436] 
ffff8789`ba764480 00000000`00000000     : ffffb403`b1993df0 00004bfc`4e66f688 00004bfc`4e66c208 0000000f`00000028 : udecx+0x91d0

SYMBOL_NAME:  pmon+11b9

MODULE_NAME: pmon

IMAGE_NAME:  pmon.sys

STACK_COMMAND:  .thread ; .cxr ; kb

BUCKET_ID_FUNC_OFFSET:  11b9

FAILURE_BUCKET_ID:  AV_pmon!unknown_function

OS_VERSION:  10.0.18362.1

BUILDLAB_STR:  19h1_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

FAILURE_ID_HASH:  {146d5e1c-c312-8f0e-6f37-5dc8aefa6e27}

Followup:     MachineOwner
cezanne commented 3 years ago

@andy010106 @TheMohawkNinja : Please retry with a new release v0.3.2.

cezanne commented 3 years ago

@andy010106 : I'll close this issue. Please reopen if you need.