调试 NDIS/WiFi 超时错误 - DRIVER_VERIFIER_DETECTED_VIOLATION (C4)
如果选择 了 NDIS/WIFI 验证 选项,并且驱动程序验证程序检测到驱动程序违反了 NDIS/WiFi 超时规则之一, 驱动程序验证程序 将生成 Bug 检查0xC4:参数 1 等于特定 NDIS/WiFi 超时规则) 标识符的DRIVER_VERIFIER_DETECTED_VIOLATION (。
当驱动程序验证程序测试 NDIS/WIFI 超时规则(如 NdisTimedOidComplete)时,驱动程序验证程序的轮询机制需要微型端口驱动程序在多个周期内做出响应。 每个计时规则都定义了自己的允许的最大周期。 超过最大值时,驱动程序验证程序将生成 bug 检查。 本部分介绍用于调试这些冲突的一些示例策略。
调试 NDIS/WIFI 超时错误
使用 !analyze 显示有关 bug 的信息检查
与发生的任何 bug 检查一样,一旦控制了调试器,最好的第一步是运行 !analyze -v 命令。
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.
Arguments:
Arg1: 00092003, ID of the 'NdisTimedOidComplete' rule that was violated.
Arg2: 8521dd34, A pointer to the string describing the violated rule condition.
Arg3: 9c17b860, Address of internal rule state (second argument to !ruleinfo).
Arg4: 9c1f3480, Address of supplemental states (third argument to !ruleinfo).
在 !analyze -v 输出的下一节中,“DV_VIOLATED_CONDITION”字段下显示了违反规则的原因。 DV_MSDN_LINK部分也可用于拉取有关此规则的文档的链接。
调试详细信息:
*** ERROR: Module load completed but symbols could not be loaded for NdisTimedOidComplete.sys
DV_VIOLATED_CONDITION: Timeout on completing an NDIS OID request.
DV_MSDN_LINK: https://learn.microsoft.com/windows-hardware/drivers/devtest/ndis-ndistimedoidcomplete
DRIVER_OBJECT: 98a87980
IMAGE_NAME: NdisTimedOidComplete.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 5229c857
MODULE_NAME: NdisTimedOidComplete
FAULTING_MODULE: 9fee1000 NdisTimedOidComplete
在此分析输出中,可以单击“DV_RULE_INFO”部分下的链接以获取其他规则说明。 对于超时类型的规则,当前堆栈可能不包含相关信息。
DV_RULE_INFO: 0x92003
BUGCHECK_STR: 0xc4_NdisTimedOidComplete_XDV
DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT
PROCESS_NAME: System
CURRENT_IRQL: 2
ANALYSIS_VERSION: 6.13.0016.1929 (debuggers(dbg).130725-1857) amd64fre
LAST_CONTROL_TRANSFER: from 80f87fd3 to 80f0ed14
STACK_TEXT:
8912380c 80f87fd3 00000003 e6c3476e 00000065 nt!RtlpBreakWithStatusInstruction
89123860 80f87aed 825a6138 89123c5c 89123cac nt!KiBugCheckDebugBreak+0x1f
89123c30 80f0d8d6 000000c4 00092003 8521dd34 nt!KeBugCheck2+0x676
89123c54 80f0d80d 000000c4 00092003 8521dd34 nt!KiBugCheck2+0xc6
89123c74 85211584 000000c4 00092003 8521dd34 nt!KeBugCheckEx+0x19
89123cac 85216d54 9c17b860 9c1f3480 9c17b8dc VerifierExt!SLIC_StatefulAbort+0x1a4
89123cd0 85216ffe 85220000 85215f5b 00000000 VerifierExt!Ndis_OnTimerExpire+0x234
89123cd8 85215f5b 00000000 80ecd56a 843d0c38 VerifierExt!CheckOnTimerExpire+0x26
89123ce0 80ecd56a 843d0c38 00000000 80ecd502 VerifierExt!XdvPassiveTimerRoutine+0x1d
89123d24 80eec133 882befd0 00000000 887debc0 nt!IopProcessWorkItem+0x68
89123d70 80ec1162 00000000 e6c342be 00000000 nt!ExpWorkerThread+0x14f
89123db0 80f23201 80eebfe4 00000000 00000000 nt!PspSystemThreadStartup+0x58
89123dbc 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x15
使用 !ruleinfo 扩展命令
!analyze 输出的 DV_RULE_INFO: 字段显示指向命令的链接,可用于查找有关此规则冲突的详细信息。 对于此示例,如果单击链接,它将运行 !ruleinfo 命令,其中包含 RULE_ID (0x92003) Arg3 和 Arg 4 bug 检查值。
kd> !ruleinfo 0x92003 0xffffffff9c17b860 0xffffffff9c1f3480
RULE_ID: 0x92003
RULE_NAME: NdisTimedOidComplete
RULE_DESCRIPTION:
This rule verifies if an NDIS miniport driver completes an OID in time.
The OID is tracked (a.k.a., TRACKED_OBJECT). Use !ndiskd.oid .
MSDN_LINK: https://learn.microsoft.com/windows-hardware/drivers/devtest/ndis-ndistimedoidcomplete
CONTEXT: Miniport 0x86BD10E8
CURRENT_TIME (Timed Rules): 168 seconds
TRACKED_OBJECT: 0x86633804
LAST_CALL_STACK: 0x9C1F3480 + 0x10
RULE_STATE: 0x9C1F3480
确定违规位置
在此示例中,微型端口驱动程序(NdisTimedOidComplete.sys)的 MPOidRequest 函数中注入了睡眠周期。 可以通过单击 !ruleinfo 输出中的LAST_CALL_STACK链接来检查。 这是驱动程序验证程序看到的最后一个调用堆栈,在超时发生之前,NDIS 调用 了 ndisMInvokeOidRequest 。
kd> dps 0x9C1F3480 + 0x10
9c1f3490 850e1e37 ndis!ndisMInvokeOidRequest+0x16641
9c1f3494 850765c8 ndis!ndisMDoOidRequest+0x24a
9c1f3498 8507552a ndis!ndisQueueOidRequest+0x2fa
9c1f349c 8507372b ndis!ndisQuerySetMiniportEx+0xd9
9c1f34a0 85073646 ndis!ndisQuerySetMiniport+0x18
9c1f34a4 850dd9c8 ndis!ndisMDoMiniportOp+0x8c
9c1f34a8 850dd916 ndis!ndisMNotifyMachineName+0xe4
9c1f34ac 85104005 ndis!ndisMInitializeAdapter+0xad7
修复 NDIS WIFI 超时冲突的原因
为计时规则生成故障转储后,有可能在故障转储时找到根本原因。 若要进一步调试,请考虑从 NdisKd 调试器扩展命令开始,请参阅 NDIS 扩展 (Ndiskd.dll) 和 NDISKD 入门。 如果驱动程序已实现 ETW,可能还需要查看 Windows (ETW 的事件跟踪) 日志。 如果未启用此规则,则此错误最多会显示为用户应用程序挂起,或者 错误检查0x9F:最坏DRIVER_POWER_STATE_FAILURE 。