Hi all
A PFN_LIST_CORRUPT memory dump similar to the one below has been reported by three different customers following the installation of our minifilter driver. In each case the fault was reported against a different third party driver (in this case McAfee’s) but I don’t think this is where the problem lies - particulary since one of them was against AFD.SYS.
The problem occurs because of an elevated reference count on a memory buffer (2 in this example). I’ve confirmed that this is the same memory buffer that is passed to Ntfs!NtfsDeleteMdlAndBuffer (84f8f000)
: kd> !pfn 00004f8d
PFN 00004F8D at address 8148B36C
flink 00000000 blink / share count 00000001 pteaddress C0427C68
reference count 0002 Cached color 0
restore pte 00000000 containing page 000B45 Active R
ReadInProgress
0: kd> !pte C0427C68
VA 84f8d000
PDE at C0602138 PTE at C0427C68
contains 0000000004E009E3 contains 0000000000000000
pfn 4e00 -GLDA–KWEV LARGE PAGE pfn 4f8d
I know that this issue is typically related to incorrect MDL handling but we don’t do any MDL manipulation directly (at least on the IO path).
After a little disassembly, it appears that NtfsCommonWrite allocates this buffer via the NtfsCreateMdlAndBuffer call then copies the write data into it. In this case the file object is for $MFT and the write buffer contains the telltale MFT entry header which supports this assertion ie
0: kd> db 84f8d000
84f8d000 46 49 4c 45 30 00 03 00-9f 14 6a 03 00 00 00 00 FILE0…j…
84f8d010 01 00 01 00 38 00 01 00-f0 01 00 00 00 04 00 00 …8…
84f8d020 00 00 00 00 00 00 00 00-03 00 00 00 94 4a 00 00 …J…
84f8d030 88 02 00 00 00 00 00 00-10 00 00 00 60 00 00 00 …`…
84f8d040 00 00 00 00 00 00 00 00-48 00 00 00 18 00 00 00 …H…
84f8d050 e2 05 d2 4f 66 6f c9 01-30 3f cc bf 0f 99 c3 01 …Ofo…0?..
84f8d060 b9 d7 2c 1d 06 9a cc 01-6b 75 fb 31 d9 6d cc 01 …,…ku.1.m…
84f8d070 01 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 …
So I’ve been looking at the lifecycle of this buffer and as far as I can tell, NtfsCommonWrite calls both NtfsCreateMdlAndBuffer and NtfsDeleteMdlAndBuffer so it’s difficult to see how our minifilter driver could influence the reference count on this buffer if it is only used internally
Is anybody able to hazard a guess as to what we might be seeing here ??
Regards
Mark
0: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
PFN_LIST_CORRUPT (4e)
Typically caused by drivers passing bad memory descriptor lists (ie: calling
MmUnlockPages twice with the same list, etc). If a kernel debugger is
available get the stack trace.
Arguments:
Arg1: 0000009a,
Arg2: 00004f8d
Arg3: 00000006
Arg4: 00000002
Debugging Details:
BUGCHECK_STR: 0x4E_9a
DEFAULT_BUCKET_ID: DRIVER_FAULT
PROCESS_NAME: System
CURRENT_IRQL: 0
LAST_CONTROL_TRANSFER: from 8086598b to 80827c83
STACK_TEXT:
f78e6540 8086598b 0000004e 0000009a 00004f8d nt!KeBugCheckEx+0x1b
f78e655c 80891779 8148b36c 808aeae0 014d2578 nt!MiBadRefCount+0x33
f78e6594 808925bb 84f8d000 84f8f000 853538e0 nt!MiFreePoolPages+0x5c9
f78e65ec f71017d9 3966744e 00000000 f78e67f0 nt!ExFreePoolWithTag+0x277
f78e65fc f7101817 8521af48 84f8d000 f7106f4b Ntfs!NtfsDeleteMdlAndBuffer+0x31
f78e66e8 f7103177 f78e6700 f71031dc e29345d0 Ntfs!NtfsCommonWrite+0x180b
f78e67f0 f71057d0 f78e6800 853538e0 0108070a Ntfs!NtfsCompleteRequest+0x35
f78e696c 8081df85 86106020 853538e0 853538e0 Ntfs!NtfsFsdWrite+0x16a
f78e6980 f7220d28 8500b700 8646d1c8 00000000 nt!IofCallDriver+0x45
f78e69ac 8081df85 86444200 853538e0 853538e0 fltmgr!FltpDispatch+0x152
f78e69c0 f7220b25 86444020 853538e0 8608cc18 nt!IofCallDriver+0x45
f78e69e4 f7220cf5 f78e6a04 86444020 00000000 fltmgr!FltpLegacyProcessingAfterPreCallbacksCompleted+0x20b
f78e6a1c 8081df85 86444020 853538e0 8578e480 fltmgr!FltpDispatch+0x11f
f78e6a30 f5d8a426 86093f90 f78e6ad4 856c0548 nt!IofCallDriver+0x45
WARNING: Stack unwind information not available. Following frames may be wrong.
f78e6ab4 f5d97bd9 86093f90 853538e0 f78e6aec mfehidk+0x7426
f78e6ac4 f5d97c29 f78e6ad4 8579af38 856c0548 mfehidk+0x14bd9
f78e6aec 8081df85 856c0548 853538e0 012a5000 mfehidk!DEVICEDISPATCH::DispatchPassThrough+0x48
f78e6b00 8081e69f 00000000 f78e6b3c 863af5f0 nt!IofCallDriver+0x45
f78e6b14 80836446 86093f0a f78e6b3c f78e6c04 nt!IoSynchronousPageWrite+0xaf
f78e6c30 8083782b e20b1528 e20b1538 863af5f0 nt!MiFlushSectionInternal+0x6ba
f78e6c74 8080f8fe 86093dc0 f78e6c00 00002000 nt!MmFlushSection+0x211
f78e6cfc 8080fc77 00002000 00000000 00000001 nt!CcFlushCache+0x3a6
f78e6d40 808127c2 8658e020 808ae5c0 8658c1f8 nt!CcWriteBehind+0x11b
f78e6d80 80880469 8658c1f8 00000000 8658e020 nt!CcWorkerThread+0x15a
f78e6dac 80949b7c 8658c1f8 00000000 00000000 nt!ExpWorkerThread+0xeb
f78e6ddc 8088e092 8088037e 00000000 00000000 nt!PspSystemThreadStartup+0x2e
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
STACK_COMMAND: kb
FOLLOWUP_IP:
mfehidk+7426
f5d8a426 8945f8 mov dword ptr [ebp-8],eax
SYMBOL_STACK_INDEX: e
SYMBOL_NAME: mfehidk+7426
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: mfehidk
IMAGE_NAME: mfehidk.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 4564d4e5
FAILURE_BUCKET_ID: 0x4E_9a_mfehidk+7426
BUCKET_ID: 0x4E_9a_mfehidk+7426