Dear list,
I have read a lot in this forum/list in the last couple of weeks in order to try to find a way to solve a BSOD that I’m dealing with. I read every thread that exist here and other sites and I still didn’t come up with an answer to a question: how to debug the DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS BSOD. The purpose of this post is to consult with you how can I find out what pages were locked and by whom, and why is the I/O manager can’t release the lock.
To give you a context to this conversation I would say that I have developed a TDI driver that analyzes the network usage parameters by processes that are running on a Windows machine. The BSOD occurs on Windows2003/XP machines and doesn’t occur on Windows7/2008. It happens once a day (more or less).
I have a full memory dump and I was trying to analyze it with the methods I read here and there, but I didn’t get to any conclusion.
The !analyze -v command shows some information, the stack trace doesn’t involve my driver:
DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS (cb)
Caused by a driver not cleaning up completely after an I/O.
When possible, the guilty driver’s name (Unicode string) is printed on
the bugcheck screen and saved in KiBugCheckDriver.
Arguments:
Arg1: f694a2f2, The calling address in the driver that locked the pages or if the
IO manager locked the pages this points to the dispatch routine of
the top driver on the stack to which the IRP was sent.
Arg2: f694b931, The caller of the calling address in the driver that locked the
pages. If the IO manager locked the pages this points to the device
object of the top driver on the stack to which the IRP was sent.
Arg3: 821a3008, A pointer to the MDL containing the locked pages.
Arg4: 00000004, The number of locked pages.
FAULTING_IP:
afd!AfdAllocateMdlChain+bf
f694a2f2 8b45dc mov eax,dword ptr [ebp-24h]
DEFAULT_BUCKET_ID: DRIVER_FAULT
BUGCHECK_STR: 0xCB
PROCESS_NAME: RequestTicket.e
CURRENT_IRQL: 0
LAST_CONTROL_TRANSFER: from 8084ddb3 to 80827e33
STACK_TEXT:
f4db7c54 8084ddb3 000000cb f694a2f2 f694b931 nt!KeBugCheckEx+0x1b
f4db7c84 8094e2c7 ffffffe9 826366f8 82636938 nt!MmCleanProcessAddressSpace+0x551
f4db7d0c 8094e41b 00000025 00000000 83e625f0 nt!PspExitThread+0x5f1
f4db7d24 8094e615 826366f8 00000025 00000001 nt!PspTerminateThreadByPointer+0x4b
f4db7d54 8088b46c 00000000 00000025 0012fe90 nt!NtTerminateProcess+0x125
f4db7d54 7c82845c 00000000 00000025 0012fe90 nt!KiFastCallEntry+0xfc
WARNING: Frame IP not in any known module. Following frames may be wrong.
0012fe90 00000000 00000000 00000000 00000000 0x7c82845c
STACK_COMMAND: .bugcheck ; kb
FOLLOWUP_IP:
afd!AfdAllocateMdlChain+bf
f694a2f2 8b45dc mov eax,dword ptr [ebp-24h]
SYMBOL_NAME: afd!AfdAllocateMdlChain+bf
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: afd
IMAGE_NAME: afd.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 4ef9d207
FAILURE_BUCKET_ID: 0xCB_afd!AfdAllocateMdlChain+bf
BUCKET_ID: 0xCB_afd!AfdAllocateMdlChain+bf
I thought that I could search for VA that are associated with the MDL and then print to a log buffer all the places that my driver allocates/dealocated/touches/locks/unlocks the memory, but it was useless since searching to the MDL pointer in the dump provided nothing:
15: kd> !search 821a3008
Searching PFNs in range 00000001 - 0003FFFF for [FFFFFFFF821A3008 - FFFFFFFF821A3008]
Pfn Offset Hit Va Pte
Search done.
Using the dt nt!_mdl command on the MDL pointer showed the following information:
15: kd> dt nt!_mdl 821a3008
+0x000 Next : (null)
+0x004 Size : 0n36
+0x006 MdlFlags : 0n138
+0x008 Process : 0x83e625f0 _EPROCESS
+0x00c MappedSystemVa : 0xf7bcae58 Void
+0x010 StartVa : 0x0012e000 Void
+0x014 ByteCount : 0x1000
+0x018 ByteOffset : 0xdf4
But it was a dead end to me too because I didn’t understand what use I can make of that information except of interpreting the MdlFlags parameter. If I understood correctly, then this MDL deals with:
MDL_PAGES_LOCKED 0x0002
MDL_ALLOCATED_FIXED_SIZE 0x0008
MDL_WRITE_OPERATION 0x0080
(information learned from this post: http://www.sysnative.com/forums/bsod-kernel-dump-analysis-debugging-information/269-fun-mdls.html)
I hope you would be able to suggest some more techniques to debug the DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS issue.