windbg-kernel-lock-deadlock-triage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKernel Lock and Deadlock Triage
内核锁与死锁分诊
Load first if it is not already loaded in this
conversation, and apply it throughout for evidence ranking, hypothesis testing,
confidence calibration, independent review, and report validation. This skill
adds the bug-family-specific commands and evidence requirements.
windbg-diagnostic-method如果当前对话中尚未加载 ,请先加载它,并在后续全程应用它,以进行证据排序、假设检验、置信度校准、独立审查和报告验证。本 skill 增加了该缺陷类别专用的命令和证据要求。
windbg-diagnostic-methodDetection
检测
Use kernel thread stacks, synchronization-object evidence, and Driver Verifier
deadlock records. A watchdog bugcheck can indicate CPU/DPC progress failures,
not necessarily a lock cycle. Establish the actual waits before choosing this
workflow.
使用内核线程堆栈、同步对象证据和 Driver Verifier 死锁记录。watchdog bugcheck 可能表示 CPU/DPC 无法推进,而不一定表示存在锁循环。在选择此工作流之前,先确定实际等待关系。
Workflow
工作流
1. Gather owners and waiters
1. 收集所有者与等待者
text
!locks
!thread <ethread-address>
!process 0 7!lockstext
!locks
!thread <ethread-address>
!process 0 7!locks2. Inspect recorded lock-order evidence
2. 检查已记录的锁顺序证据
If Driver Verifier deadlock detection was enabled and the dump contains its
records:
text
!deadlock 1Inspect the reported resources, acquisition sequence, and threads. Verifier
can detect an unsafe ordering before a persistent deadlock actually forms.
An empty result without the required verification/history is not proof that
the lock order is safe. For Verifier setup/safety use .
windbg-kernel-verifier-triage如果已启用 Driver Verifier 死锁检测,且 dump 中包含其记录:
text
!deadlock 1检查报告的资源、获取顺序和线程。Verifier 可以在形成持续性死锁之前检测到不安全的顺序。如果缺少必要的验证/历史记录,空结果并不能证明锁顺序是安全的。有关 Verifier 的设置/安全性,请使用 。
windbg-kernel-verifier-triage3. Build and test the graph
3. 构建并检验图
text
thread A holds resource X -> waits for Y owned by B
thread B holds resource Y -> waits for X owned by AShow evidence for every edge. Check recursive acquisition, callbacks under
locks, I/O completion dependencies, and destruction/rundown paths.
Distinguish:
- A demonstrated cycle or Verifier-reported order inversion.
- Contention where a runnable owner can progress.
- Starvation or an owner blocked on a separate request.
- Spin/IRQL problems, which are not necessarily blocking-lock deadlocks.
If blocked on an IRP use ; if a chain crosses into a
user-mode COM/RPC operation use . Carry the proven graph
edges into the next skill rather than starting the same investigation again.
windbg-kernel-irp-lifecycle-triagewindbg-user-wait-chain-analysistext
thread A holds resource X -> waits for Y owned by B
thread B holds resource Y -> waits for X owned by A为每条边提供证据。检查递归获取、持锁期间的回调、I/O 完成依赖关系,以及销毁/rundown 路径。
区分:
- 已证实的循环或 Verifier 报告的顺序反转。
- 所有者可运行并取得进展的争用。
- 饥饿,或所有者阻塞在另一个独立请求上。
- Spin/IRQL 问题;这些问题不一定是阻塞锁死锁。
如果阻塞在 IRP 上,请使用 ;如果等待链延伸至用户模式 COM/RPC 操作,请使用 。将已证实的图边传递给下一个 skill,而不是重复同一调查。
windbg-kernel-irp-lifecycle-triagewindbg-user-wait-chain-analysis4. Localize the driver path
4. 定位驱动程序路径
Identify which call path held one resource while acquiring/waiting for another.
Check the required IRQL, permitted waits, lock hierarchy, and object lifetime.
Private Windows implementation layouts are not prerequisites; if public
symbols and captured state cannot recover an edge, request appropriate
authorized evidence and keep the conclusion provisional.
确定在获取/等待另一个资源时仍持有第一个资源的调用路径。检查所需 IRQL、允许的等待、锁层级和对象生命周期。私有 Windows 实现布局并非必要前提;如果公共符号和捕获的状态无法恢复某条边,请请求适当的授权证据,并将结论保持为暂定结论。
Fix patterns
修复模式
Use a consistent acquisition hierarchy, reduce lock scope, avoid unbounded
waits/cross-component callbacks while holding resources, and move potentially
blocking destruction outside locks where the ownership design permits.
Do not replace a lock or add a timeout without preserving invariants and
completion/cancellation semantics.
使用一致的获取层级,缩小锁作用域,避免在持有资源时进行无限期等待或跨组件回调,并在所有权设计允许的情况下,将可能阻塞的销毁操作移到锁外。
不要在未保留不变量以及完成/取消语义的情况下替换锁或添加超时。
Validation
验证
Record the graph, supported cycle/inversion, and offending driver path.
Test concurrency, callbacks, teardown, and the same applicable Verifier checks.
Separate a demonstrated fix from an unproven contention hypothesis.
记录图、有证据支持的循环/顺序反转,以及存在问题的驱动程序路径。测试并发、回调、teardown,以及同样适用的 Verifier 检查。
将已证实的修复与未经证实的争用假设区分开来。
References
参考
Feedback
反馈
Follow and report reviewed, sanitized feedback to
WinDbg-Feedback.
Include and the package version from ; no
automatic dump, lock-history transcript, or driver-source upload.
FEEDBACK.mdwindbg-kernel-lock-deadlock-triageplugin.json遵循 ,并向 WinDbg-Feedback 提交经过审查且已脱敏的反馈。请包含 以及 中的包版本;不要自动上传 dump、锁历史记录转录或驱动程序源代码。
FEEDBACK.mdwindbg-kernel-lock-deadlock-triageplugin.json