Hi !
I am testing my driver with driver verifier (All options turned ON except
low resource simulation)
I encountered the following crash -
****************************************************************************
** **
** Deadlock detected! Type !deadlock in the debugger for more information **
** **
****************************************************************************
*** Fatal System Error: 0x000000c4
(0x00001001,0x8A7D6B28,0x89FDFF28,0x00000000)
Break instruction exception - code 80000003 (first chance)
On further analysis with the !analyze -v and !deadlock commands, I observe
the following -
0: kd> !deadlock 1
issue: 00001001 00000000 8A7D4B28 FFFFFFFF
Deadlock detected (2 resources in 2 threads):
Thread 0: 00000000 took locks in the following order:
Lock A – 8a7d4b28 (Queued Spinlock)
Stack: Mydriver!MydriverTimer+0xCA
nt!KiTimerExpiration+0x255
8B110F70
Mydriver!ClientEventReceive+0x96
DBGHELP: tcpip - public symbols
c:\symbols\tcpip.pdb\471846DDF72D4D6195488E9DD171FAC52\tcpip.pdb
tcpip!IndicateData+0x214
tcpip!TCPRcv+0xADB
tcpip!DeliverToUser+0x17B
tcpip!IPRcvPacket+0x66C
Lock B – Mydriver!abortPktListSpinLock (Queued Spinlock)
Stack: Mydriver!AddPktToAbortList+0x18
Mydriver!MydriverTimer+0x11B
nt!KiTimerExpiration+0x255
Thread 1: 80579D00 took locks in the following order:
Lock B – Mydriver!abortPktListSpinLock (Queued Spinlock)
Stack: Mydriver!SendAborts+0x1F
nt!KiTimerExpiration+0x255
8B110F70
Lock A – 8a7d4b28 (Queued Spinlock)
Stack: << Current stack >>
I have a fn which has the following logic -
Fn()
{
KeAcquireSpinLock A
:
Do something
:
KeAcquireSpinLock B
:
Do something
:
KeReleaseSpinLock B
KeReleaseSpinLock A
:
Do something
:
KeAcquireSpinLock B
:
Do something
:
KeAcquireSpinLock A
:
Do something
:
KeReleaseSpinLock A
KeReleaseSpinLock B
}
Very clearly, this code will result in a deadlock if two threads execute
Fn() at different times. However, in my case, only one thread executes this
code. Does Driver Verifier crash only after it has entered a deadlock state,
or will it crash when it sees a possibility of a deadlock ?
The !deadlock command showed Thread 0 as 00000000 … what does that mean ?
In my driver, only one thread could be running the Fn() code at a given
time.
Your critical comments are awaited …
Thanks,
-g