I FINALLY GOT AROUND TO ANALYZE THIS (RANDOM ) DEADLOCK(S). I captured
two scenairo ( but they are identical,
Interms of analysis so I’m putting up just one.
The system is windows 2000 spx ( not exactly sure, will check soon ).
At the very last step I’m stuck since there is no thread to look for
(7fffffff )
Would appreciate if anyone sheds some light.
It happens when we try to let the standy and wakeup happens one or two
times.
I will try to catch some more instances to make fairly sure that the
cause is basically same, hence the analysis is somewhat like what I
spitted out below.
-pro
0: kd> !locks
**** DUMP OF ALL RESOURCE OBJECTS ****
KD: Scanning for held locks…
Resource @ nt!IopDeviceTreeLock (0x8054e380) Shared 1 owning threads
<<<<– (1)
Contention Count = 1
Threads: 820a6da0-02<*>
KD: Scanning for held locks…
Resource @ 0x81bad7c0 Shared 1 owning threads
Threads: 820a76a3-01<*> *** Actual Thread 820A76A0
KD: Scanning for held locks.
Resource @ 0x81af39c0 Shared 1 owning threads
Threads: 820a76a3-01<*> *** Actual Thread 820A76A0
KD: Scanning for held locks…
Resource @ 0x820a0bc0 Shared 1 owning threads
Threads: 820a76a3-01<*> *** Actual Thread 820A76A0
KD: Scanning for held locks.
1528 total locks, 4 locks currently held
0: kd> !strct eresource 0x8054e380 <<<— (1)
struct _ERESOURCE (sizeof=56)
+00 struct _LIST_ENTRY SystemResourcesList
+00 struct _LIST_ENTRY *Flink = 820C6AD8
+04 struct _LIST_ENTRY *Blink = 8209E120
+08 struct _OWNER_ENTRY *OwnerTable = 81F3A348
+0c int16 ActiveCount = 0001
+0e uint16 Flag = 0000
+10 struct _KSEMAPHORE *SharedWaiters = 81B1A668 <<<— (2)
+14 struct _KEVENT *ExclusiveWaiters = 00000000
+18 struct _OWNER_ENTRY OwnerThreads[2]
+18 OwnerThreads[0]
+18 uint32 OwnerThread = 00000000
+1c int32 OwnerCount = 00000000
+1c uint32 TableSize = 00000000
+20 OwnerThreads[1]
+20 uint32 OwnerThread = 820a6da0
+24 int32 OwnerCount = 00000002
+24 uint32 TableSize = 00000002
+28 uint32 ContentionCount = 00000001
+2c uint16 NumberOfSharedWaiters = 0000
+2e uint16 NumberOfExclusiveWaiters = 0000
+30 void *Address = 00000000
+30 uint32 CreatorBackTraceIndex = 00000000
+34 uint32 SpinLock = 00000000
0: kd> !strct KSEMAPHORE 81B1A668 <<<— (2)
struct _KSEMAPHORE (sizeof=20)
+00 struct _DISPATCHER_HEADER Header
+00 byte Type = 05
.
+01 byte Absolute = 00
.
+02 byte Size = 05
.
+03 byte Inserted = 00
.
+04 int32 SignalState = 00000000
+08 struct _LIST_ENTRY WaitListHead <<<<---- (*)
+08 struct _LIST_ENTRY *Flink = 81B1A670 <<<<—(3)
+0c struct _LIST_ENTRY *Blink = 81B1A670
+10 int32 Limit = 7fffffff
0: kd> !list 81B1A668+8 <<<<— (3)
struct _LIST_ENTRY (sizeof=8)
+0 struct _LIST_ENTRY *Flink = 81B1A670
+4 struct _LIST_ENTRY *Blink = 81B1A670
0: kd> dl 81B1A668+8 <<<<---- (3)
81b1a670 81b1a670 81b1a670 7fffffff 84000003
0: kd> !strct KWAIT_BLOCK 81B1A670
struct _KWAIT_BLOCK (sizeof=24)
+00 struct _LIST_ENTRY WaitListEntry
+00 struct _LIST_ENTRY *Flink = 81B1A670
+04 struct _LIST_ENTRY *Blink = 81B1A670
+08 struct _KTHREAD *Thread = 7FFFFFFF <<<<—<<<—
(???)
+0c void *Object = 84000003
+10 struct _KWAIT_BLOCK *NextWaitBlock = 02018001
+14 uint16 WaitKey = 744e
+16 uint16 WaitType = 6e66
0: kd> !strct eresource 0x81bad7c0
struct _ERESOURCE (sizeof=56)
+00 struct _LIST_ENTRY SystemResourcesList
+00 struct _LIST_ENTRY *Flink = 81AE5E9C
+04 struct _LIST_ENTRY *Blink = 81B1FD3C
+08 struct _OWNER_ENTRY *OwnerTable = 00000000
+0c int16 ActiveCount = 0001
+0e uint16 Flag = 0008
+10 struct _KSEMAPHORE *SharedWaiters = 00000000 <<<— Noone
waiting
+14 struct _KEVENT *ExclusiveWaiters = 00000000
+18 struct _OWNER_ENTRY OwnerThreads[2]
+18 OwnerThreads[0]
+18 uint32 OwnerThread = 00000000
+1c int32 OwnerCount = 00000000
+1c uint32 TableSize = 00000000
+20 OwnerThreads[1]
+20 uint32 OwnerThread = 820a76a3
+24 int32 OwnerCount = 00000001
+24 uint32 TableSize = 00000001
+28 uint32 ContentionCount = 00000000
+2c uint16 NumberOfSharedWaiters = 0000
+2e uint16 NumberOfExclusiveWaiters = 0000
+30 void *Address = 00000000
+30 uint32 CreatorBackTraceIndex = 00000000
+34 uint32 SpinLock = 00000000
0: kd> !strct eresource 0x81af39c0
struct _ERESOURCE (sizeof=56)
+00 struct _LIST_ENTRY SystemResourcesList
+00 struct _LIST_ENTRY *Flink = 8206DFBC
+04 struct _LIST_ENTRY *Blink = 81AE76DC
+08 struct _OWNER_ENTRY *OwnerTable = 00000000
+0c int16 ActiveCount = 0001
+0e uint16 Flag = 0008
+10 struct _KSEMAPHORE *SharedWaiters = 00000000 <<<— Noone
waiting
+14 struct _KEVENT *ExclusiveWaiters = 00000000
+18 struct _OWNER_ENTRY OwnerThreads[2]
+18 OwnerThreads[0]
+18 uint32 OwnerThread = 00000000
+1c int32 OwnerCount = 00000000
+1c uint32 TableSize = 00000000
+20 OwnerThreads[1]
+20 uint32 OwnerThread = 820a76a3
+24 int32 OwnerCount = 00000001
+24 uint32 TableSize = 00000001
+28 uint32 ContentionCount = 00000000
+2c uint16 NumberOfSharedWaiters = 0000
+2e uint16 NumberOfExclusiveWaiters = 0000
+30 void *Address = 00000000
+30 uint32 CreatorBackTraceIndex = 00000000
+34 uint32 SpinLock = 00000000
0: kd> !strct eresource 0x820a0bc0
struct _ERESOURCE (sizeof=56)
+00 struct _LIST_ENTRY SystemResourcesList
+00 struct _LIST_ENTRY *Flink = 81AF7240
+04 struct _LIST_ENTRY *Blink = 81B01C40
+08 struct _OWNER_ENTRY *OwnerTable = 00000000
+0c int16 ActiveCount = 0001
+0e uint16 Flag = 0008
+10 struct _KSEMAPHORE *SharedWaiters = 00000000 <<<— Noone
waiting on this
+14 struct _KEVENT *ExclusiveWaiters = 00000000
+18 struct _OWNER_ENTRY OwnerThreads[2]
+18 OwnerThreads[0]
+18 uint32 OwnerThread = 00000000
+1c int32 OwnerCount = 00000000
+1c uint32 TableSize = 00000000
+20 OwnerThreads[1]
+20 uint32 OwnerThread = 820a76a3
+24 int32 OwnerCount = 00000001
+24 uint32 TableSize = 00000001
+28 uint32 ContentionCount = 00000000
+2c uint16 NumberOfSharedWaiters = 0000
+2e uint16 NumberOfExclusiveWaiters = 0000
+30 void *Address = 00000000
+30 uint32 CreatorBackTraceIndex = 00000000
+34 uint32 SpinLock = 00000000
0: kd> !locks -v
**** DUMP OF ALL RESOURCE OBJECTS ****
Resource @ nt!MmSystemWsLock (0x80559020) Available
Contention Count = 24
Resource @ nt!IopDeviceTreeLock (0x8054e380) Shared 1 owning threads
Contention Count = 1
Threads: 820a6da0-02<*>
THREAD 820a6da0 Cid 8.24 Teb: 00000000 Win32Thread: 00000000
WAIT: (Suspended) KernelMode Non-Alertable
eb843a54 NotificationEvent
IRP List:
81abd848: (0006,0100) Flags: 00000000 Mdl: 00000000
Not impersonating
Owning Process 820ae5e0
Wait Start TickCount 8964 Elapsed Ticks: 1282
Context Switch Count 256
UserTime 0:00:00.0000
KernelTime 0:00:00.0078
Start Address nt!ExpWorkerThread (0x804eb3d2)
Stack Init eb844000 Current eb8439c8 Base eb844000 Limit eb841000
Call 0
Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 0
ChildEBP RetAddr Args to Child
eb8439e0 80500321 81abcbe8 eb843abc 00000000 nt!KiSwapThread+0x1b1
eb843a08 eb4416d9 eb843a54 00000005 00000000
nt!KeWaitForSingleObject+0x1a3
eb843a94 eb440cd6 81f383f0 eb843abc 81b16dc8 +0xeb4416d9
eb843b14 eb692465 81f383f0 81f383f0 81f384a8 +0xeb440cd6
00000000 00000000 00000000 00000000 00000000 +0xeb692465
Resource @ 0x81b1fd3c Available
Resource @ 0x81bad7c0 Shared 1 owning threads
Threads: 820a76a3-01<*> *** Actual Thread 820A76A0
THREAD 820a76a0 Cid 8.14 Teb: 00000000 Win32Thread: 00000000
RUNNING
Not impersonating
Owning Process 820ae5e0
Wait Start TickCount 8964 Elapsed Ticks: 1282
Context Switch Count 609
UserTime 0:00:00.0000
KernelTime 0:00:20.0031
Start Address nt!ExpWorkerThread (0x804eb3d2)
Stack Init eb834000 Current eb833d34 Base eb834000 Limit eb831000
Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 0
ChildEBP RetAddr Args to Child
eb833cbc 8053e236 00000001 00000002 000000d1
nt!RtlpBreakWithStatusInstruction
eb833cbc 80539782 00000001 00000002 000000d1
nt!KeUpdateSystemTime+0x14e
eb833d68 804f4357 8201c030 81b16000 8054b440
nt!KefAcquireSpinLockAtDpcLevel+0x12
eb833d78 804eb481 81ae0f08 00000000 00000000
nt!IopProcessWorkItem+0xf
eb833da8 80529a82 81ae0f08 00000000 00000000
nt!ExpWorkerThread+0xaf
eb833ddc 8053f012 804eb3d2 00000000 00000000
nt!PspSystemThreadStartup+0x54
00000000 00000000 00000000 00000000 00000000
nt!KiThreadStartup+0x16
Resource @ 0x81af39c0 Shared 1 owning threads
Threads: 820a76a3-01<*> *** Actual Thread 820A76A0
THREAD 820a76a0 Cid 8.14 Teb: 00000000 Win32Thread: 00000000
RUNNING
Not impersonating
Owning Process 820ae5e0
Wait Start TickCount 8964 Elapsed Ticks: 1282
Context Switch Count 609
UserTime 0:00:00.0000
KernelTime 0:00:20.0031
Start Address nt!ExpWorkerThread (0x804eb3d2)
Stack Init eb834000 Current eb833d34 Base eb834000 Limit eb831000
Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 0
ChildEBP RetAddr Args to Child
eb833cbc 8053e236 00000001 00000002 000000d1
nt!RtlpBreakWithStatusInstruction
eb833cbc 80539782 00000001 00000002 000000d1
nt!KeUpdateSystemTime+0x14e
eb833d68 804f4357 8201c030 81b16000 8054b440
nt!KefAcquireSpinLockAtDpcLevel+0x12
eb833d78 804eb481 81ae0f08 00000000 00000000
nt!IopProcessWorkItem+0xf
eb833da8 80529a82 81ae0f08 00000000 00000000
nt!ExpWorkerThread+0xaf
eb833ddc 8053f012 804eb3d2 00000000 00000000
nt!PspSystemThreadStartup+0x54
00000000 00000000 00000000 00000000 00000000
nt!KiThreadStartup+0x16
Resource @ 0x820a0bc0 Shared 1 owning threads
Threads: 820a76a3-01<*> *** Actual Thread 820A76A0
THREAD 820a76a0 Cid 8.14 Teb: 00000000 Win32Thread: 00000000
RUNNING
Not impersonating
Owning Process 820ae5e0
Wait Start TickCount 8964 Elapsed Ticks: 1282
Context Switch Count 609
UserTime 0:00:00.0000
KernelTime 0:00:20.0031
Start Address nt!ExpWorkerThread (0x804eb3d2)
Stack Init eb834000 Current eb833d34 Base eb834000 Limit eb831000
Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 0
ChildEBP RetAddr Args to Child
eb833cbc 8053e236 00000001 00000002 000000d1
nt!RtlpBreakWithStatusInstruction
eb833cbc 80539782 00000001 00000002 000000d1
nt!KeUpdateSystemTime+0x14e
eb833d68 804f4357 8201c030 81b16000 8054b440
nt!KefAcquireSpinLockAtDpcLevel+0x12
eb833d78 804eb481 81ae0f08 00000000 00000000
nt!IopProcessWorkItem+0xf
eb833da8 80529a82 81ae0f08 00000000 00000000
nt!ExpWorkerThread+0xaf
eb833ddc 8053f012 804eb3d2 00000000 00000000
nt!PspSystemThreadStartup+0x54
00000000 00000000 00000000 00000000 00000000
nt!KiThreadStartup+0x16
Resource @ 0x81af7240 Available
Resource @ 0x81af0bc0 Available
1528 total locks, 4 locks currently held