Dear All:
I’m porting a CANBUS driver from the SerialPort sample driver, and have the read/write operation work when I send data from one computer and receive from another one. But I get a BSOD after about 10 minutes and get the following message
========================WinDbg Message Start================
Microsoft (R) Windows Debugger Version 6.11.0001.404 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.
Opened \.\com6
Waiting to reconnect…
Connected to Windows 7 7601 x86 compatible target at (Fri Mar 14 13:36:23.195 2014 (GMT+8)), ptr64 FALSE
Kernel Debugger connection established.
Symbol search path is: C:\WinDBG\EPM3112\symbolFile\bus\i386;C:\WinDBG\EPM3112\symbolFile\func\i386;C:\Symbols
Executable search path is: C:\WinDBG\EPM3112\symbolFile\bus\i386;C:\WinDBG\EPM3112\symbolFile\func\i386
Windows 7 Kernel Version 7601 (Service Pack 1) MP (2 procs) Free x86 compatible
Product: WinNt, suite: TerminalServer EmbeddedNT SingleUserTS
Built by: 7601.17514.x86fre.win7sp1_rtm.101119-1850
Machine Name:
Kernel base = 0x82c11000 PsLoadedModuleList = 0x82d515b0
Debug session time: Sat Mar 15 08:48:02.198 2014 (GMT+8)
System Uptime: 0 days 0:02:20.289
Break instruction exception - code 80000003 (first chance)
*******************************************************************************
* *
* You are seeing this message because you pressed either *
* CTRL+C (if you run kd.exe) or, *
* CTRL+BREAK (if you run WinDBG), *
* on your debugger machine’s keyboard. *
* *
* THIS IS NOT A BUG OR A SYSTEM CRASH *
* *
* If you did not intend to break into the debugger, press the “g” key, then *
* press the “Enter” key now. This message might immediately reappear. If it *
* does, press “g” and “Enter” again. *
* *
*******************************************************************************
nt!RtlpBreakWithStatusInstruction:
82c69d00 cc int 3
0: kd> g
Access violation - code c0000005 (!!! second chance !!!)
839cd018 8b700c mov esi,dword ptr [eax+0Ch]
0: kd> !analyze -v
Connected to Windows 7 7601 x86 compatible target at (Fri Mar 14 13:38:48.460 2014 (GMT+8)), ptr64 FALSE
Loading Kernel Symbols
…
…
…
Loading User Symbols
…
Loading unloaded module list
…*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
*** ERROR: Module load completed but symbols could not be loaded for Wdf01000.sys
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Unknown bugcheck code (0)
Unknown bugcheck description
Arguments:
Arg1: 00000000
Arg2: 00000000
Arg3: 00000000
Arg4: 00000000
Debugging Details:
*** ERROR: Symbol file could not be found. Defaulted to export symbols for kernel32.dll -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for mxdev.dll -
*** ERROR: Module load completed but symbols could not be loaded for mxcan_loop_test.exe
ERROR: Could Not Find Target OS Version. Please Update GetFunctionForOSVer to include target OS Version
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: kernel32!pNlsUserInfo ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: kernel32!pNlsUserInfo ***
*** ***
*************************************************************************
PROCESS_NAME: mxcan_loop_tes
FAULTING_IP:
Wdf01000+40018
839cd018 8b700c mov esi,dword ptr [eax+0Ch]
EXCEPTION_RECORD: ffffffff – (.exr 0xffffffffffffffff)
ExceptionAddress: 839cd018 (Wdf01000+0x00040018)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000004
Attempt to read from address 00000004
ERROR_CODE: (NTSTATUS) 0xc0000005 - 0x%08lx
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - 0x%08lx
EXCEPTION_PARAMETER1: 00000000
EXCEPTION_PARAMETER2: 00000004
READ_ADDRESS: 00000004
FOLLOWUP_IP:
mxcport!WdfObjectGetTypedContextWorker+18 [c:\winddk\7600.16385.0\inc\wdf\kmdf\1.9\wdfobject.h @ 409]
903df5f8 5d pop ebp
BUGCHECK_STR: ACCESS_VIOLATION
DEFAULT_BUCKET_ID: NULL_CLASS_PTR_DEREFERENCE
CURRENT_IRQL: 0
LAST_CONTROL_TRANSFER: from 903df5f8 to 839cd018
STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be wrong.
a894da58 903df5f8 903ea014 a894da74 903df9d4 Wdf01000+0x40018
a894da64 903df9d4 00000000 903ea014 a894da90 mxcport!WdfObjectGetTypedContextWorker+0x18 [c:\winddk\7600.16385.0\inc\wdf\kmdf\1.9\wdfobject.h @ 409]
a894da74 903e35d1 00000000 00000003 903e7330 mxcport!MxCanGetRequestContext+0x14 [c:\winddk\7600.16385.0\embeddedstandard\expansioncard\epm-3112\wdf\epm_3112_kmdf_2014-03-13-09\2.src\driver\func\shared\toaster.h @ 810]
a894da90 903e2cc0 00000000 903e2090 00000000 mxcport!MxCanSetCancelRoutine+0x11 [c:\winddk\7600.16385.0\embeddedstandard\expansioncard\epm-3112\wdf\epm_3112_kmdf_2014-03-13-09\2.src\driver\func\featured\utils.c @ 160]
a894dad4 903e4092 879bd1d8 00000000 00000018 mxcport!MxCanStartRead+0x1b0 [c:\winddk\7600.16385.0\embeddedstandard\expansioncard\epm-3112\wdf\epm_3112_kmdf_2014-03-13-09\2.src\driver\func\featured\read.c @ 1063]
a894db04 903ebb11 879bd1d8 77bc3308 78641278 mxcport!MxCanStartOrQueue+0xc2 [c:\winddk\7600.16385.0\embeddedstandard\expansioncard\epm-3112\wdf\epm_3112_kmdf_2014-03-13-09\2.src\driver\func\featured\utils.c @ 820]
a894db94 839bc02a 78641698 77bc3308 00000014 mxcport!ToasterEvtIoRead+0x1e1 [c:\winddk\7600.16385.0\embeddedstandard\expansioncard\epm-3112\wdf\epm_3112_kmdf_2014-03-13-09\2.src\driver\func\featured\toaster.c @ 1086]
a894dbb0 839bd256 78641698 77bc3308 00000014 Wdf01000+0x2f02a
a894dbd8 839bf9ac 77bc3308 8843ccf0 879be960 Wdf01000+0x30256
a894dbf4 839c0a36 879be900 00000000 879bde30 Wdf01000+0x329ac
a894dc14 839c2824 8843ccf0 88688820 879bd6e0 Wdf01000+0x33a36
a894dc38 839b1a3f 88646df8 a894dc5c 82c40047 Wdf01000+0x35824
a894dc44 82c40047 879bd6e0 88646df8 88646df8 Wdf01000+0x24a3f
a894dc5c 82e169d5 88646df8 88646e8c 88688820 nt!IofCallDriver+0x63
a894dc7c 82e178bc 879bd6e0 88688820 00000001 nt!IopSynchronousServiceTail+0x1f8
a894dd08 82c4687a 879bd6e0 88646df8 00000000 nt!NtReadFile+0x644
a894dd08 76f970b4 879bd6e0 88646df8 00000000 nt!KiFastCallEntry+0x12a
00b4f2cc 76c8974f 00000040 00b4f36c 00000014 ntdll!KiFastSystemCallRet
00b4f314 1000751b 00000040 00b4f36c 00000014 kernel32!ReadFile+0x54
00b4f338 012c1170 00000040 00b4f36c 00000014 mxdev!mxcan_read+0x2b
00b4f33c 00000000 00b4f36c 00000014 00000000 mxcan_loop_test+0x1170
STACK_COMMAND: kb
FAULTING_SOURCE_CODE:
No source found for ‘c:\winddk\7600.16385.0\inc\wdf\kmdf\1.9\wdfobject.h’
SYMBOL_STACK_INDEX: 1
SYMBOL_NAME: mxcport!WdfObjectGetTypedContextWorker+18
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: mxcport
IMAGE_NAME: mxcport.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 5321657f
FAILURE_BUCKET_ID: ACCESS_VIOLATION_mxcport!WdfObjectGetTypedContextWorker+18
BUCKET_ID: ACCESS_VIOLATION_mxcport!WdfObjectGetTypedContextWorker+18
Followup: MachineOwner
========================Request Context Start================
The WinDbg says WdfObjectGetTypedContextWorker cause the access violation, but I have no idea on how to debug it, because it’s a wdf api. The only clue is I use self-defined request context, so I guess if the context causes the BSOD issue randomly
========================WinDbg Message End================
typedef struct _REQUEST_CONTEXT {
ULONG_PTR Information;
NTSTATUS Status;
ULONG Length;
PVOID RefCount;
PVOID SystemBuffer;
UCHAR MajorFunction;
PFN_WDF_REQUEST_CANCEL CancelRoutine;
BOOLEAN Cancelled;
PVOID Type3InputBuffer;
PFDO_DATA Extension; //PSERIAL_DEVICE_EXTENSION Extension;
ULONG IoctlCode;
BOOLEAN MarkCancelableOnResume;
} REQUEST_CONTEXT, *PREQUEST_CONTEXT;
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(REQUEST_CONTEXT, MxCanGetRequestContext)
========================Request Context End================
Thanks in advance