title | description | ms.date | keywords | topic_type | ms.topic | api_name | api_type | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
IrqlExApcLte3 Rule (WDM) |
The IrqlExApcLte3 rule specifies that the driver calls the following executive support routines only at IRQL APC_LEVEL. |
05/21/2018 |
|
|
reference |
|
|
The IrqlExApcLte3 rule specifies that the driver calls the following executive support routines only at IRQL <= APC_LEVEL.
Drivers that have errors related to IRQL can cause serious problems and could cause a computer to crash.
Driver model: WDM
Bug check(s) found with this rule: Bug Check 0xC4: DRIVER_VERIFIER_DETECTED_VIOLATION (0x20007), Bug Check 0xA: IRQL_NOT_LESS_OR_EQUAL
The following code violates this rule:
NTSTATUS
DispatchRequest (
_In_ PDEVICE_REQUEST DeviceRequest
)
{
KIRQL OldIrql;
KSPIN_LOCK SpinLock;
NTSTATUS Status;
...
KeInitializeSpinLock(&SpinLock);
//
// KeAcquireSpinLock sets IRQL to DISPATCH_LEVEL and the previous IRQL is
// written to OldIrql after the lock is acquired.
//
KeAcquireSpinLock(&SpinLock, &OldIrql);
...
Status = ProcessRequest(DeviceRequest);
//
// KeReleaseSpinLock sets IRQL to the OldIrql returned by KeAcquireSpinLock.
//
KeReleaseSpinLock(&SpinLock, &OldIrql);
...
}
NTSTATUS
ProcessRequest (
_In_ PDEVICE_REQUEST DeviceRequest
)
{
ERESOURCE Resource;
NTSTATUS Status;
...
Resource = DeviceRequest->GetTableLock();
//
// RULE VIOLATION! - ExAcquireSharedStarveExclusive can be called only at
// IRQL <= APC_LEVEL.
//
if(!ExAcquireSharedStarveExclusive(&Resource, FALSE)) {
return STATUS_UNSUCCESSFUL;
}
...
ExReleaseResourceLite(&Resource);
...
return Status;
}
At compile time |
---|
Run Static Driver Verifier and specify the IrqlExApcLte3 rule. Use the following steps to run an analysis of your code:
For more information, see Using Static Driver Verifier to Find Defects in Drivers. |
At run time |
---|
Run Driver Verifier and select the DDI compliance checking option. |
ExAcquireResourceExclusiveLite ExAcquireResourceSharedLite ExAcquireSharedStarveExclusive ExAcquireSharedWaitForExclusive ExConvertExclusiveToSharedLite ExDeleteResourceLite
Managing Hardware Priorities Preventing Errors and Deadlocks While Using Spin Locks