Hitchhiker
October 21st, 2008, 09:24
We're seeing some very strange filter driver behavior (also
observable on standard MS WDK Minifilter sample). A "freeze" occurs
on some Windows XP sp2 versions (especially images dated ~2007,
including all patches) On other versions (like clear old XP sp2) this
problem is not observed.
note:
- Problem can be replicated easily on XP SP2 with system files of
version 5.1.2600.2978 (explorer right click on "fltmgr.sys" and see
version tab)
- Problem is not seen if SP3 is installed
Problem description :
1. Take WDK minspy sample (src/filesys/minifilter/minispy)
2. Build driver & console app, put together driver & app & inf.
Change inside inf "Instance1.Flags = 0x1"
to "Instance1.Flags = 0" for auto attachment to logical drive
3. Install minspy driver
4. Start minispy ("net start minispy"
5. All seems good at this stage
6.Change in driver source (minispy)
Original mspyLib.c:
- since line numbers may differ across various WDK versions, grep for:
in function VOID SpyLog (__in PRECORD_LIST RecordList)
565: KeAcquireSpinLock(&MiniSpyData.OutputBufferLock, &oldIrql);
566: InsertTailList(&MiniSpyData.OutputBufferList, &RecordList->List);
567: KeReleaseSpinLock(&MiniSpyData.OutputBufferLock, oldIrql);
Changed:
565: KeAcquireSpinLock(&MiniSpyData.OutputBufferLock, &oldIrql);
566: //InsertTailList(&MiniSpyData.OutputBufferList, &RecordList->List);
567: KeReleaseSpinLock(&MiniSpyData.OutputBufferLock, oldIrql);
568: SpyFreeRecord (RecordList);
I.e. tell driver to not store log and immediately free block
7. Rebuild driver
8. Place it to system32/drivers (overwrite old one)
9. "net start minispy"
10. Here we go.. freezing
Best seen in MSVS 2005 — open project — two/three times switch
debug/release on toolbar. MSVS 2005 (depending from machine speed) can
freeze 10-30 seconds to minutes !
11. net stop minispy
12. All freezes vanish (MSVS 2005 doesn't freeze at all)
- if we release memory immediately after request big freezes appear in
the system. (possibly on ExFreeToNPagedLookasideList)
- the main question is — what the heck is this ? a bug in minifilter system ?
In a real driver , it is a pain ( impossible / quite hard ) to do
remitted memory frees ( as seen in minispy by default ).
The " magic " solution of remitted frees seems spooky without further
insight. Anyone understand what's going on ?
observable on standard MS WDK Minifilter sample). A "freeze" occurs
on some Windows XP sp2 versions (especially images dated ~2007,
including all patches) On other versions (like clear old XP sp2) this
problem is not observed.
note:
- Problem can be replicated easily on XP SP2 with system files of
version 5.1.2600.2978 (explorer right click on "fltmgr.sys" and see
version tab)
- Problem is not seen if SP3 is installed
Problem description :
1. Take WDK minspy sample (src/filesys/minifilter/minispy)
2. Build driver & console app, put together driver & app & inf.
Change inside inf "Instance1.Flags = 0x1"
to "Instance1.Flags = 0" for auto attachment to logical drive
3. Install minspy driver
4. Start minispy ("net start minispy"

5. All seems good at this stage
6.Change in driver source (minispy)
Original mspyLib.c:
- since line numbers may differ across various WDK versions, grep for:
in function VOID SpyLog (__in PRECORD_LIST RecordList)
565: KeAcquireSpinLock(&MiniSpyData.OutputBufferLock, &oldIrql);
566: InsertTailList(&MiniSpyData.OutputBufferList, &RecordList->List);
567: KeReleaseSpinLock(&MiniSpyData.OutputBufferLock, oldIrql);
Changed:
565: KeAcquireSpinLock(&MiniSpyData.OutputBufferLock, &oldIrql);
566: //InsertTailList(&MiniSpyData.OutputBufferList, &RecordList->List);
567: KeReleaseSpinLock(&MiniSpyData.OutputBufferLock, oldIrql);
568: SpyFreeRecord (RecordList);
I.e. tell driver to not store log and immediately free block
7. Rebuild driver
8. Place it to system32/drivers (overwrite old one)
9. "net start minispy"
10. Here we go.. freezing
Best seen in MSVS 2005 — open project — two/three times switch
debug/release on toolbar. MSVS 2005 (depending from machine speed) can
freeze 10-30 seconds to minutes !
11. net stop minispy
12. All freezes vanish (MSVS 2005 doesn't freeze at all)
- if we release memory immediately after request big freezes appear in
the system. (possibly on ExFreeToNPagedLookasideList)
- the main question is — what the heck is this ? a bug in minifilter system ?
In a real driver , it is a pain ( impossible / quite hard ) to do
remitted memory frees ( as seen in minispy by default ).
The " magic " solution of remitted frees seems spooky without further
insight. Anyone understand what's going on ?