Hello,
I have a filecopy routine in kernel-mode and when I issue IRP_MJ_WRITE,
irp->UserBuffer is sometimes used in non-system process by ecache.sys
(ReadyBoost, Vista OS). Since MDL was only mapped into system process,
ecache driver accesses invalid memory. How can map MDL into all processes?
In system workitem, I open the file and then call:
-
MmCreateSection + MmMapViewOfSection
-
MmInitializeMdl + MmProbeAndLockPages
and issue IRP_MJ_WRITE with:
-
irp->MdlAddress = pMdl;
-
irp->UserBuffer = MmGetMdlVirtualAddress( pMdl );
Thanks,
Petr
kd> dt nt!_MDL 9aea6084
+0x000 Next : (null)
+0x004 Size : 100
+0x006 MdlFlags : 3 (MDL_MAPPED_TO_SYSTEM_VA | MDL_PAGES_LOCKED)
+0x008 Process : 0x83333a58 _EPROCESS
+0x00c MappedSystemVa : 0x02330000
+0x010 StartVa : 0x02330000
+0x014 ByteCount : 0x11400
+0x018 ByteOffset : 0
ecache.sys callstack:
kd> kb
ChildEBP RetAddr Args to Child
8039d97c 818e6c83 00000003 1f0f5e92 00000000
nt!RtlpBreakWithStatusInstruction
8039d9cc 818e7769 00000003 02330000 8185feb4 nt!KiBugCheckDebugBreak+0x1c
8039dd98 81866fb9 0000000a 02330000 00000002 nt!KeBugCheck2+0x66d
8039dd98 8185feb4 0000000a 02330000 00000002 nt!KiTrap0E+0x2e1
8039de30 8612b128 9aebf000 02330000 00011400 nt!RtlCompareMemory+0x14
8039de94 818c01fb 850d3020 84642d70 00d350f8
ecache!EcDispatchReadWriteCompletion+0x462
8039dec8 8615fd5f 8039defc 8615f3ee 84c6eac8 nt!IopfCompleteRequest+0x11d
8039ded0 8615f3ee 84c6eac8 84642d70 00000001
CLASSPNP!ClassCompleteRequest+0x11
8039defc 818c01fb 00000000 83353c08 00f774f8
CLASSPNP!TransferPktComplete+0x2b6
8039df34 805be047 84f775a4 8039df78 805c1658 nt!IopfCompleteRequest+0x11d
8039df40 805c1658 83353c08 00000001 00000000
storport!RaidCompleteRequestEx+0x1c
8039df78 805be31f 845d6008 81913300 8039dff4
storport!RaidUnitCompleteRequest+0x8f
8039df88 818c36a2 843529cc 84352958 00000000
storport!RaidpAdapterDpcRoutine+0x28
8039dff4 818c12d5 884b0ad0 00000000 00000000 nt!KiRetireDpcList+0x147
8039dff8 884b0ad0 00000000 00000000 00000000 nt!KiDispatchInterrupt+0x45