Hi all,
I am getting a crash when an application uses the TransmitFile API with my
file system. I am running on Windows XP SP2 checked build.
My file system gets a buffered, async, IRP_MJ_READ/IRP_MN_NORMAL, with a
non-null MDL (see stack trace 1 below). My dispatch routine gets the buffer
address from the MDL by calling MmGetSystemAddressForMdlSafe() and, for
debugging purposes at the moment, does nothing with it. I do not touch the
MDL otherwise. The dispatch routine then completes the IRP with
STATUS_SUCCESS and the length of the read.
I see the following assert (see stack trace 2):
*** Assertion failed: (MemoryDescriptorList->MdlFlags & MDL_PAGES_LOCKED) !=
0
*** Source File: d:\xpsprtm\base\ntos\mm\iosup.c, line 2346
followed eventually by the crash.
The MDL that my file system gets in the READ IRP looks like this:
kd> dt 85236fc4 pifsk!MDL
+0x000 Next : (null)
+0x004 Size : 32
+0x006 MdlFlags : 4 –> MDL_SOURCE_IS_NONPAGED_POOL
+0x008 Process : (null)
+0x00c MappedSystemVa : 0x85236000
+0x010 StartVa : 0x85236000
+0x014 ByteCount : 0xc04
+0x018 ByteOffset : 0
This MDL is not locked coming into my dispatch routine, and I do lock it
myself, so this explains the assert. My question though is: why is the MDL
not locked coming into my dispatch routine? The only other cases where I
have seen non-null MDLs in the READ IRP is for paging io, and those are all
locked coming in.
Thanks.
stack trace 1
ChildEBP RetAddr Args to Child
f3af0abc 80a21a49 851923d0 85236ee8 851923d0 Pifsk!PifsDispatchRead+0x973
[s:\pi\store\pifs.new\pifsk\read.cpp @ 440]
f3af0ad4 80cd4128 85236ee8 85236ea0 f3af0b18 nt!IopfCallDriver+0x51
f3af0af8 f5410567 00000103 86208b60 86208b60 nt!IovCallDriver+0xa0
f3af0b00 86208b60 86208b60 851923d0 f3af0b38 afd!AfdTPacketsBufferRead+0x217
WARNING: Frame IP not in any known module. Following frames may be wrong.
f3af0b38 f5411510 00000000 80102424 86716fdc 0x86208b60
f3af0bf4 f542b4bb 85a15e08 86716f00 00000000 afd!AfdTransmitFile+0x57c
f3af0c08 80a21a49 85a15e08 00716f00 85a15e08
afd!AfdDispatchDeviceControl+0x4b
f3af0c20 80cd4128 84e2efb8 801023e8 86716f00 nt!IopfCallDriver+0x51
f3af0c44 80b3157e 86716fdc 85aa5ee8 86716f00 nt!IovCallDriver+0xa0
f3af0c58 80b32663 85a15e08 86716f00 85aa5ee8
nt!IopSynchronousServiceTail+0x94
f3af0cf4 80b27bcc 00000424 000006f0 00000000 nt!IopXxxControlFile+0x64f
f3af0d28 80ad5a48 00000424 000006f0 00000000 nt!NtDeviceIoControlFile+0x2a
f3af0d28 7c834684 00000424 000006f0 00000000 nt!KiFastCallEntry+0x158
0336ead0 7c80e244 47398be0 00000424 000006f0 ntdll!KiFastSystemCallRet
0336ead4 47398be0 00000424 000006f0 00000000 ntdll!NtDeviceIoControlFile+0xc
0336eb74 4739ef8d 00000424 00000760 00010000 mswsock!MSAFD_TransmitFile+0xaa
*** WARNING: Unable to verify checksum for libapr-1.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for
libapr-1.dll -
0336eba0 6eecba4d 00000424 00000760 00010000 mswsock!TransmitFile+0x64
00000000 00000000 00000000 00000000 00000000
libapr_1!apr_socket_sendfile+0x2ad
stack trace 2
ChildEBP RetAddr Args to Child
f3af074c 80abbf3e 85236fc4 00000000 f3af0b18 nt!DbgBreakPoint
f3af0a3c 80abbf80 80a4f40e 80a4f3ee 0000092a nt!RtlAssert2+0x104
f3af0a58 80a4ff3f 80a4f40e 80a4f3ee 0000092a nt!RtlAssert+0x18
f3af0a90 80b0dd38 85236fc4 85de1560 851923d0 nt!MmUnlockPages+0x2b
f3af0aa4 80a18a68 85de1560 85236fc4 f3af0ad0 nt!CcMdlReadComplete2+0x16
f3af0ab4 80a1944a 85de1560 85236fc4 851923d0 nt!FsRtlMdlReadCompleteDev+0x10
f3af0ad0 f540dbbe 85de1560 85236fc4 85236fc4 nt!FsRtlMdlReadComplete+0x5e
f3af0ae4 f545ab02 85de1560 85236fc4 85236ea8 afd!AfdMdlReadComplete+0x32
85236fc4 00040020 00000000 85236000 85236000 afd!AfdCleanupPacketChain+0x14c
WARNING: Frame IP not in any known module. Following frames may be wrong.
f3af0b38 f5411510 00000002 80102424 86716fdc 0x40020
f3af0bf4 f542b4bb 85a15e08 86716f00 00000000 afd!AfdTransmitFile+0x57c
f3af0c08 80a21a49 85a15e08 00716f00 85a15e08
afd!AfdDispatchDeviceControl+0x4b
f3af0c20 80cd4128 84e2efb8 801023e8 86716f00 nt!IopfCallDriver+0x51
f3af0c44 80b3157e 86716fdc 85aa5ee8 86716f00 nt!IovCallDriver+0xa0
f3af0c58 80b32663 85a15e08 86716f00 85aa5ee8
nt!IopSynchronousServiceTail+0x94
f3af0cf4 80b27bcc 00000424 000006f0 00000000 nt!IopXxxControlFile+0x64f
f3af0d28 80ad5a48 00000424 000006f0 00000000 nt!NtDeviceIoControlFile+0x2a
f3af0d28 7c834684 00000424 000006f0 00000000 nt!KiFastCallEntry+0x158
0336ead0 7c80e244 47398be0 00000424 000006f0 ntdll!KiFastSystemCallRet
0336ead4 47398be0 00000424 000006f0 00000000 ntdll!NtDeviceIoControlFile+0xc
=================================================
Roger Tawa
http://tawacentral.net/
[One thing about paradigms: shift happens.]
[When you stop, you’re done.]