Hi folks,
Verifier bugchecks my driver when the driver is being unloaded. And the Verifier says there are allocations not freed in our driver.
1: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
DRIVER_VERIFIER_DETECTED_VIOLATION (c4)
A device driver attempting to corrupt the system has been caught. This is
because the driver was specified in the registry as being suspect (by the
administrator) and the kernel has enabled substantial checking of this driver.
If the driver attempts to corrupt the system, bugchecks 0xC4, 0xC1 and 0xA will
be among the most commonly seen crashes.
Parameter 1 = 0x1000 .. 0x1020 - deadlock verifier error codes.
Typically the code is 0x1001 (deadlock detected) and you can
issue a '!deadlock' KD command to get more information.
Arguments:
Arg1: 00000062, A driver has forgotten to free its pool allocations prior to unloading.
Arg2: 8713cabc, name of the driver having the issue.
Arg3: 8713b700, verifier internal structure with driver information.
Arg4: 00000001, total # of (paged+nonpaged) allocations that weren't freed.
Type !verifier 3 drivername.sys for info on the allocations
that were leaked that caused the bugcheck.
Debugging Details:
BUGCHECK_STR: 0xc4_62
IMAGE_NAME: mydriver.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 4d7db948
MODULE_NAME: mydriver
FAULTING_MODULE: 93d71000 mydriver
DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT
PROCESS_NAME: System
CURRENT_IRQL: 2
LAST_CONTROL_TRANSFER: from 82b52f1f to 828fadfc
STACK_TEXT:
87b27a90 82b52f1f 000000c4 00000062 8713cabc nt!KeBugCheckEx+0x1e
87b27ab0 82b57607 8713cabc 8713b700 93d71000 nt!VerifierBugCheckIfAppropriate+0x30
87b27ac0 8282aeaa 8713ca60 8295dec8 8295dec8 nt!VfPoolCheckForLeaks+0x33
87b27afc 829af6b4 8713ca60 93d71000 40000000 nt!VfTargetDriversRemove+0x66
87b27b10 829af34d 829667e0 851eca70 00000000 nt!VfDriverUnloadImage+0x5e
87b27b48 829b05a2 8713ca60 ffffffff 00000000 nt!MiUnloadSystemImage+0x1c6
87b27b6c 82ad9a2b 8713ca60 851eeeb0 8714edf8 nt!MmUnloadSystemImage+0x36
87b27b84 82a3fa98 8714ee10 8714ee10 8714edf8 nt!IopDeleteDriver+0x38
87b27b9c 82887080 00000000 8245e800 8245e750 nt!ObpRemoveObjectRoutine+0x59
87b27bb0 82886ff0 8714ee10 829d7cd2 851eef78 nt!ObfDereferenceObjectWithTag+0x88
87b27bb8 829d7cd2 851eef78 8245e738 8245e750 nt!ObfDereferenceObject+0xd
87b27bcc 82a3fa98 8245e750 8245e750 8245e738 nt!IopDeleteDevice+0x4e
87b27be4 82887080 00000000 82983e80 851e60d8 nt!ObpRemoveObjectRoutine+0x59
87b27bf8 82886ff0 8245e750 829d0384 a6cfacd0 nt!ObfDereferenceObjectWithTag+0x88
87b27c00 829d0384 a6cfacd0 a69ed8f8 00000000 nt!ObfDereferenceObject+0xd
87b27c1c 829d130d a69ed8f8 a9e512d0 a9e512b0 nt!PnpUnlinkDeviceRemovalRelations+0xe0
87b27cc4 829d3226 87b27cf4 00000000 a9e512b0 nt!PnpProcessQueryRemoveAndEject+0xa05
87b27cdc 829d4d6e 00000000 90488c18 851eca70 nt!PnpProcessTargetDeviceEvent+0x38
87b27d00 8288c03b 90488c18 00000000 851eca70 nt!PnpDeviceEventWorker+0x216
87b27d50 82a2c9df 00000001 8f61c205 00000000 nt!ExpWorkerThread+0x10d
87b27d90 828de1d9 8288bf2e 00000001 00000000 nt!PspSystemThreadStartup+0x9e
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x19
STACK_COMMAND: kb
FOLLOWUP_NAME: MachineOwner
FAILURE_BUCKET_ID: 0xc4_62_VRF_IMAGE_mydriver.sys
BUCKET_ID: 0xc4_62_VRF_IMAGE_mydriver.sys
Followup: MachineOwner
Then I type "!verifier 3 mydriver.sys". It says the leaked pool is at paged pool, but it doesn't supply the address of the leadked memory. Please look at below:
1: kd> !verifier 3 mydriver.sys
Verify Level 9bb ... enabled options are:
Special pool
Special irql
All pool allocations checked on unload
Io subsystem checking enabled
Deadlock detection enabled
DMA checking enabled
Security checks enabled
Miscellaneous checks enabled
Summary of All Verifier Statistics
RaiseIrqls 0x0
AcquireSpinLocks 0x2032
Synch Executions 0x0
Trims 0x10
Pool Allocations Attempted 0x53ec5
Pool Allocations Succeeded 0x53ec5
Pool Allocations Succeeded SpecialPool 0x53ec5
Pool Allocations With NO TAG 0x0
Pool Allocations Failed 0x0
Resource Allocations Failed Deliberately 0x0
Current paged pool allocations 0x1 for 00000030 bytes
Peak paged pool allocations 0x7 for 00000600 bytes
Current nonpaged pool allocations 0x0 for 00000000 bytes
Peak nonpaged pool allocations 0x25 for 0000F744 bytes
Driver Verification List
Entry State NonPagedPool PagedPool Module
ERROR: BaseAddress is NULL for suspect drivers list entry at 850a4b28.
I don't know what module the leaked pool is at.
What should I do to find out the leakage function in my codes?
Any help is appreciated!!!
Joseph