Hello Experts,
I need help with an issue that’s bugging me for some time now.
In a specific case of an application load and exit, there is an open file handle created in the context of NtCreateUserProcess that stays open for minutes after application exit. This is undesirable in our system due to security reasons. This problem does not reproduce on Vista 32-bit. This problem also does not reproduce on Win 7 x64 if the application doesn’t exit immediately on launch. Any hints on what’s causing the file handle to stay open in this case? Any hints on speeding the file handle close?
Thanks in advance,
Vinod Mamtani
Environment:
Windows 7 x64
Stack trace for open handle:
1: kd> kv
Child-SP RetAddr : Args to Child : Call Site
fffff880066826e0 fffff880
01040288 : fffffa800489d9f0 fffff880
066827e8 fffff8a003c8b280 00000000
00000000 : minime!MiniMeFilePostCreateCallback+0x203 [c:\src\snippets\minime\filetrack.c @ 427]
fffff880066827a0 fffff880
0103ed1b : fffffa80023ce960 fffffa80
0489db10 fffffa800233fd40 fffffa80
0233ff60 : fltmgr!FltpPerformPostCallbacks+0x368
fffff88006682870 fffff880
0105e2b9 : fffffa8005164260 fffffa80
0287f280 fffffa8005164200 fffffa80
0287fae0 : fltmgr!FltpLegacyProcessingAfterPreCallbacksCompleted+0x39b
fffff88006682900 fffff800
02397495 : 0000000000000000 fffffa80
02303cc8 0000000000000000 fffff8a0
002041e0 : fltmgr!FltpCreate+0x2a9
fffff880066829b0 fffff800
02393d38 : fffffa80027339d0 fffff800
00000000 fffffa8002303b10 00000000
00000001 : nt!IopParseDevice+0x5a5
fffff88006682b40 fffff800
02394f56 : 0000000000000000 fffffa80
02303b10 fffffa8002882180 fffffa80
0184f8a0 : nt!ObpLookupObjectName+0x588
fffff88006682c30 fffff800
0239685c : fffff8a0039263a8 00000000
00000000 fffff88006683100 00000000
00000080 : nt!ObOpenObjectByName+0x306
fffff88006682d00 fffff800
02382134 : fffff88006683740 00000000
001000a1 fffff88006683128 fffff880
06683158 : nt!IopCreateFile+0x2bc
fffff88006682da0 fffff800
020988d3 : fffff8a0039263a8 fffff880
012e77d6 000000000000004c fffff880
06683300 : nt!NtOpenFile+0x58
fffff88006682e30 fffff800
02094e70 : fffff8000234478c 00000000
00000000 fffff88006683a01 fffff880
00000000 : nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff88006682ea0) fffff880
06683038 fffff8000234478c : 00000000
00000000 fffff88006683a01 fffff880
00000000 fffff88000000000 : nt!KiServiceLinkage fffff880
06683040 fffff800020988d3 : 00000000
00000000 0000007fffffffff 00000000
00000000 0000098000000000 : nt!NtCreateUserProcess+0x2eb fffff880
06683b70 0000000077c21dea : 00000000
7455b9eb 00000000002e37e0 00000000
0028e8c0 000000000008ead0 : nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880
06683be0)
000000000008dd38 00000000
7455b9eb : 00000000002e37e0 00000000
0028e8c0 000000000008ead0 00000000
0008ead0 : ntdll!NtCreateUserProcess+0xa
000000000008dd40 00000000
745713e7 : 000000000008e268 00000000
0028e8c0 000000000028ef30 00000000
0008ead0 : wow64!Wow64NtCreateUserProcess+0x15f
000000000008e130 00000000
7455cf87 : 000000000008e2f8 00000000
7efdb000 000000007efdd000 00000000
74570bf8 : wow64!whNtCreateUserProcess+0x7ef
000000000008e350 00000000
744e2776 : 00000000004fdd2d 00000000
74550023 0000000000200246 00000000
0028e82c : wow64!Wow64SystemServiceEx+0xd7
000000000008ec10 00000000
7455d07e : 0000000000000000 00000000
744e1920 000000000008eea0 00000000
77bfecd1 : wow64cpu!TurboDispatchJumpAddressEnd+0x2d
000000000008ecd0 00000000
7455c549 : 0000000000000000 00000000
00000000 0000000074554ac8 00000000
7ffe0030 : wow64!RunCpuSimulation+0xa
000000000008ed20 00000000
77c14956 : 00000000002e3330 00000000
00000000 0000000077d02670 00000000
77cd5978 : wow64!Wow64LdrpInitialize+0x429
000000000008f270 00000000
77c11a17 : 0000000000000000 00000000
77c14061 000000000008f820 00000000
00000000 : ntdll!LdrpInitializeProcess+0x17e4
000000000008f760 00000000
77bfc32e : 000000000008f820 00000000
00000000 000000007efdf000 00000000
00000000 : ntdll! ?? ::FNODOBFM::string'+0x29220 00000000
0008f7d0 0000000000000000 : 00000000
00000000 0000000000000000 00000000
00000000 00000000`00000000 : ntdll!LdrInitializeThunk+0xe
Open handle:
0: kd> !handle 0 4
PROCESS fffffa8001823840
SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 00187000 ObjectTable: fffff8a000001980 HandleCount: 512.
Image: System
Kernel handle table at fffff8a002124000 with 512 entries in use
…
0874: Object: fffffa80022435a0 GrantedAccess: 00000080 Entry: fffff8a002bfd1d0
Object: fffffa80022435a0 Type: (fffffa800184f8a0) File
ObjectHeader: fffffa8002243570 (new version)
HandleCount: 1 PointerCount: 15
Directory Object: 00000000 Name: \Program Files\App1\abcdef.exe {HarddiskVolume1}
…
Close handle:
0: kd> kv
Child-SP RetAddr : Args to Child : Call Site
fffff880061b08e0 fffff800
02390471 : fffffa8001823840 fffffa80
00000000 fffff8a000001980 00000000
00000000 : nt!ObpDecrementHandleCount+0xf3
fffff880061b0960 fffff800
02390a34 : 0000000000000874 fffffa80
01823840 fffff8a000001980 00000000
00000874 : nt!ObpCloseHandleTableEntry+0xb1
fffff880061b09f0 fffff800
020988d3 : fffffa8002238b60 fffff880
061b0ac0 fffff800022356f0 00000000
00000000 : nt!ObpCloseHandle+0x94
fffff880061b0a40 fffff800
02094e70 : fffff8000237e67e 00000000
00000001 fffff800022356f0 fffff800
022356f0 : nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880061b0a40) fffff880
061b0bd8 fffff8000237e67e : 00000000
00000001 fffff800022356f0 fffff800
022356f0 fffff800022356d0 : nt!KiServiceLinkage fffff880
061b0be0 fffff80002080ee6 : fffffa80
04cc7110 0000000000000000 fffff800
61626453 fffff880061b0ca8 : nt!AelReleaseCacheExeMessageAttributes+0x3a fffff880
061b0c10 fffff8000201bb90 : 00000000
00000000 0000000000000001 00000000
00000000 fffffa8002238b60 : nt!ApphelpServiceFreeWorkItem+0x36 fffff880
061b0c40 fffff800020a3a21 : fffff800
020341f8 fffff80002236658 fffffa80
02238b60 fffff80002236658 : nt! ?? ::FNODOBFM::
string’+0x53013
fffff880061b0c70 fffff800
02336cce : 0000000000000000 fffffa80
02238b60 0000000000000080 fffffa80
01823840 : nt!ExpWorkerThread+0x111
fffff880061b0d00 fffff800
0208afe6 : fffff8000220be80 fffffa80
02238b60 fffffa80021e0040 00000000
00000000 : nt!PspSystemThreadStartup+0x5a
fffff880061b0d40 00000000
00000000 : fffff880061b1000 fffff880
061ab000 fffff880061b09a0 00000000
00000000 : nt!KxStartSystemThread+0x16