Xpersona
L

linux-kernel-crash-debug

CLAWHUB · Unverified

Debug Linux kernel crashes using evidence-first vmcore analysis, the crash utility, and memory/concurrency debugging tools. Use when users mention kernel crash, kernel panic, vmcore analysis, kernel dump debugging, crash utility, kernel oops debugging, pstore or ramoops, soft/hard lockup, hung task, OOM, locating root causes of kernel issues, regression bisection, mutex ownership, ARM64 lock-pointer recovery, KASAN, KFENCE, KCSAN, Lockdep, drgn, Kprobes, Kmemleak, memory corruption, out-of-bounds access, use-after-free, race, deadlock, or memory leak detection. Skill: linux-kernel-crash-debug Owner: crazyss Summary: Debug Linux kernel crashes using evidence-first vmcore analysis, the crash utility, and memory/concurrency debugging tools. Use when users mention kernel crash, kernel panic, vmcore analysis, kernel dump debugging, crash utility, kernel oops debugging, pstore or ramoops, soft/hard lockup, hung task, OOM, locating root causes of kernel issues, regression bisectio

62
Rank
84
Safety
2.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 2.2K downloads reported by the source. Last updated 10/9/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s1713waqstjfmkvf75c3tcrf1983rfz3:linux-kernel-crash-debug
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-crazyss-linux-kernel-crash-debug/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

151,627 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: linux-kernel-crash-debug
version: 1.4.5
description: Debug Linux kernel crashes using evidence-first vmcore analysis, the crash utility, and memory/concurrency debugging tools. Use when users mention kernel crash, kernel panic, vmcore analysis, kernel dump debugging, crash utility, kernel oops debugging, pstore or ramoops, soft/hard lockup, hung task, OOM, locating root causes of kernel issues, regression bisection, mutex ownership, ARM64 lock-pointer recovery, KASAN, KFENCE, KCSAN, Lockdep, drgn, Kprobes, Kmemleak, memory corruption, out-of-bounds access, use-after-free, race, deadlock, or memory leak detection.
metadata:
  openclaw:
    requires:
      bins:
        - crash
    os:
      - linux
    homepage: https://github.com/crazyss/linux-kernel-crash-debug
---

# Linux Kernel Crash Debugging

This skill guides you through analyzing Linux kernel crash dumps using the crash utility.

## Installation

Install only when the user requests installation. These commands place skill files in the user workspace; they do not authorize services, startup hooks, or background jobs.

### Claude Code
```bash
claude skill install linux-kernel-crash-debug.skill
```

### OpenClaw
```bash
# Method 1: Install via ClawHub
clawhub install linux-kernel-crash-debug

# Method 2: Manual installation
mkdir -p ~/.openclaw/workspace/skills/linux-kernel-crash-debug
cp SKILL.md ~/.openclaw/workspace/skills/linux-kernel-crash-debug/
```

## Quick Start

**Language choice:** Respond in the user’s preferred language. `SKILL_CN.md` and Chinese references are optional companion material; translate relevant explanations when requested. Source titles retain their original language for attribution.

### Starting a Session

```bash
# Analyze a dump file
crash vmlinux vmcore

# Debug a running system
crash vmlinux

# Raw RAM dump
crash vmlinux ddr.bin --ram_start=0x80000000
```

### Core Debugging Workflow

```console
0. Preserve checksums, vmcore-dmesg, build IDs, modules, config, and command line
1. crash> sys              # Validate release/build and panic context
2. crash> log              # Find the FIRST anomaly, not only the last panic
3. crash> bt / bt -a       # Compare panic task with all active CPUs
4. crash> mod              # Confirm faulting module symbols are available
5. crash> struct / kmem    # Test a specific object-lifetime hypothesis
6. Search upstream and verify good/bad kernels before claiming a regression
```

Read `references/evidence-first-workflow.md` before deep analysis. It defines
the evidence-quality gates, failure-type routing, hypothesis ledger, tool
escalation rules, and root-cause report format. Never equate the panic task,
fault site, corruption site, and root cause without supporting evidence.

For worked evidence chains, read Cases 13–15 in `references/case-studies.md`:
GRO header-offset reconstruction, InfiniBand error-path double free, and
filesystem writeback/reclaim deadlock. Treat a bisect result as a candidate
trigger, an NMI fr

_meta.json

{
  "ownerId": "kn7bvdes11tvf2t7m4d89c6n01808n3d",
  "slug": "linux-kernel-crash-debug",
  "version": "1.4.5",
  "publishedAt": 1791469601761
}

references/advanced-commands.md

# Advanced Commands Reference

Detailed advanced command usage, loaded on demand.

## list - Linked List Traversal

Traverse kernel linked lists, automatically following next/prev pointers:

```
# Basic syntax
list <struct.member> <start_addr>
list -h <start_addr>    # start is a data structure containing embedded list_head
list -H <start_addr>    # start is a standalone LIST_HEAD() address

# Common options
-o offset     # offset of next pointer within structure
-s struct     # format and display structure contents
-S struct     # read member values directly from memory
-r            # reverse traversal (using prev pointer)
-B            # use Brent's algorithm to detect circular lists
-e end        # specify end address

# Examples
# Traverse task hierarchy
crash> list task_struct.p_pptr c169a000

# Traverse file system types
crash> list file_system_type.next -s file_system_type.name,fs_flags c03adc90

# Traverse run queue
crash> list task_struct.run_list -H runqueue_head

# Traverse all task PIDs
crash> list task_struct.tasks -s task_struct.pid -h ffff88012b98e040

# Traverse dentry subdirectories
crash> list -o dentry.d_child -s dentry.d_name.name -O dentry.d_subdirs -h <parent_dentry>

# Detect circular lists
crash> list -B -h <start_addr>
```

## rd - Memory Read

Read and display memory contents:

```
# Basic syntax
rd [options] <address|symbol> [count]

# Address type options
-p      # physical address
-u      # user virtual address
-m      # Xen host machine address
-f      # dumpfile offset

# Output format options
-d      # signed decimal
-D      # unsigned decimal
-x      # suppress ASCII translation
-s      # symbolic display
-S      # show slab cache name
-N      # network byte order
-R      # reverse display
-a      # ASCII character display

# Data size options
-8      # 8-bit
-16     # 16-bit
-32     # 32-bit (default)
-64     # 64-bit

# Range options
-e addr     # display up to specified address
-o offs     # offset from start address
-r file     # output raw data to file

# Examples
crash> rd -a linux_banner       # ASCII display of kernel version string
crash> rd -s f6e31f70 28        # symbolic display of 28 words
crash> rd -S f6e31f70 28        # show slab cache names
crash> rd -SS f6e31f70 28       # double slab display
crash> rd -d jiffies            # decimal display
crash> rd -64 kernel_version    # 64-bit display
crash> rd c009bf2c -e c009bf60  # range display
crash> rd -p 1000 10            # read from physical address
crash> rd -u 80b4000 20         # read from user space
```

## search - Memory Search

Search for specific values in memory:

```
# Basic syntax
search [options] <value>

# Search scope options
-s start    # start address
-e end      # end address
-l length   # search length
-k          # kernel virtual address space
-K          # kernel space (excluding vmalloc)
-V          # kernel space (excluding unity-mapped)
-u          # user virtual address space
-p          # physical address space
-t          

references/agentic-heuristics.md

# Agentic Debugging Heuristics

This file outlines the definitive workflow an autonomous AI Agent must follow when handling advanced Linux kernel crashes using this system. It uses restricted offline analysis operations rather than arbitrary interpreter input.

## 1. Safety Directives & the `scripts/agent-crash.sh` Wrapper
Interactive commands (like a plain `crash` session REPL) will cause the Agent's subshell to freeze and timeout. Massive output (e.g., listing 100,000 active processes) will crash the Agent's context window.

**Mandate:** Always use the provided `scripts/agent-crash.sh` wrapper script instead of calling `crash` directly.
```bash
# General Syntax
./scripts/agent-crash.sh -k /path/to/vmlinux -c /path/to/vmcore <macro_or_command>

# Example: bounded offline memory read
./scripts/agent-crash.sh -k vmlinux -c vmcore read-memory ffff880123456789 128
```

Before interpreting output, follow `evidence-first-workflow.md`: record dump
completeness, kernel/module build provenance, taint, and the earliest anomaly.
The wrapper limits output volume; it does not make mismatched symbols or a
filtered-out address trustworthy.

## 2. Upstream Verification (The Hacker Instinct)
Before diving into assembly, a seasoned kernel developer checks for known fixes.
- If `scripts/agent-crash.sh triage` reveals a `kernel BUG at fs/pipe.c:120!`, the Agent should parse the signature and first sanitize the signature (remove hostnames, customer identifiers, paths, addresses, credentials, and proprietary modules), then search official upstream sources or use local `git grep` on the Linux kernel to see if this has already been fixed. Do not reinvent the wheel if a known CVE/Bugzilla is present.

## 3. High-Level Macro Workflows (1:1 Case Mapping)

The wrapper provides tailored APIs for standard debugging methodologies defined in `case-studies.md`.

* **Triage / Base Panic**: `scripts/agent-crash.sh -k vmlinux -c vmcore triage`
  Provides `sys`, a high-signal event index, log tail, panic/all-CPU backtraces,
  and the loaded-module inventory.
* **Deadlock Analysis**: `scripts/agent-crash.sh -k vmlinux -c vmcore flow-deadlock`
  Automatically extracts all UN (Uninterruptible) task backtraces filtering out idle CPU noise.
* **OOM Analysis**: `scripts/agent-crash.sh -k vmlinux -c vmcore flow-oom`
  Automatically runs complex sorts to deliver the explicitly top 15 memory-hogging processes and SLAB caches without overflowing the Agent's context.

## 4. The "Linus" Method: Reverse Engineering 
If line numbers from Backtraces are wrong due to compiler optimization (`-O2`):
- **Command**: `scripts/agent-crash.sh -k vmlinux -c vmcore dis-regs <faulty_function> <panicked_pid>`
- **Technique**: Read the exact `dis` assembly pointer (RIP). Cross-reference the exact active `%rax`, `%rdi`, or `%rsi` registers returned by `bt -f`. Map the assembly instructions to the C source snippet to deduce exactly what variable caused the corruption or NULL deref.

## 5. Memory Poison Dictiona

references/arm64-crash-params.md

# ARM64 Crash 命令关键地址参数详解

> Language note: Chinese explanations and original source titles are optional companion material. Follow the user’s preferred language and translate relevant passages when needed; no locale is required.


> **本文档解析 ARM64 平台在 raw RAM、VMCOREINFO 缺失/损坏或旧工具无法自动解析时,`crash` 需要的地址参数**。标准 kdump vmcore 应先尝试 `crash vmlinux vmcore`,因为现代转储会通过 VMCOREINFO 携带这些布局信息。
>
> **核心来源**:[Kernel panic 实验室 - Crash 分析中关键地址参数的含义](https://mp.weixin.qq.com/s/UPI8j-GacIPFStX_dbNP9Q) | [VMCOREINFO 官方文档](https://docs.kernel.org/admin-guide/kdump/vmcoreinfo.html)

---

## 1. 回退命令模板

```bash
crash_arm64 \
  -m vabits_actual=<VA_BITS> \
  -m phys_offset=<物理基地址> \
  -m kimage_voffset=<VA-PA偏移> \
  -m kaslr=<KASLR随机偏移> \
  vmlinux \
  vmcore@<vmcore起始地址> \
  --kaslr=<KASLR偏移>
```

> ⚠️ **何时要带这些参数**?crash 需要还原代码段、数据段和物理/虚拟地址映射。标准 kdump 通常从 VMCOREINFO 获取;raw dump 或损坏/缺失 VMCOREINFO 时,才需要人工补齐。不要复制另一次启动的数值。

---

## 2. 四个关键参数

### 2.1 `vabits_actual` — 虚拟地址位宽

**含义**:内核虚拟地址空间的位数。对应内核的 `VA_BITS` 配置。

**典型值**:
- 39(2^39 字节可寻址范围)— 常见配置之一
- 48(256T 虚拟地址空间)— 高端服务器

**来源**:内核编译配置 `CONFIG_ARM64_VA_BITS=39` 或 `=48`

**举例**:
```bash
crash_arm64 -m vabits_actual=39 ...
```

---

### 2.2 `phys_offset` — 物理内存基地址

**含义**:实际物理内存的起始地址。

**典型值**:
- `0x80000000`(2GB 起始)— 主流 ARM64 SoC
- `0x0`(低端起始)— 较少见

**如何确定**:
- 查看 SoC 参考手册(DDR 控制器映射)
- 或在运行系统中读 `/proc/iomem` 头部的 System RAM 段

**举例**(DDR 物理起始于 0x80000000):
```bash
crash_arm64 -m phys_offset=0x80000000 ...
```

---

### 2.3 `kimage_voffset` — VA 与 PA 之间的固定偏移

**含义**:内核 `_text` 段虚拟地址与物理地址之间的差值。

**来源**(head.S 中 `__primary_switched` 函数):

```assembly
adrp    x0, KERNEL_START     // x0 = _text 的物理地址
ldr_l   x4, kimage_vaddr     // x4 = _text 的虚拟地址
sub     x4, x4, x0           // x4 = kimage_vaddr - __pa(_text)
str_l   x4, kimage_voffset, x5
```

**简化公式**:
```
kimage_voffset = __va(_text) - __pa(_text) = kimage_vaddr - phys_of(_text)
```

**为什么需要?**:用于内核虚拟地址 ↔ 物理地址之间的转换。

**典型值**:
- 39 位 VA_BITS:`0xffffffc000000000`(`-2^39` 偏移)
- 48 位 VA_BITS:`0xffff800000000000`(`-2^48` 偏移)

**举例**:
```bash
crash_arm64 -m kimage_voffset=0xffffffc000000000 ...
```

---

### 2.4 `kaslr` / `kaslr_offset` — KASLR 随机偏移

**含义**:内核实际加载的虚拟地址与预期虚拟加载地址之间的差值。

**公式**:
```
kaslr_offset = kimage_vaddr - KIMAGE_VADDR
```

其中:
- `kimage_vaddr = (u64)&_text`(`_text` 段虚拟地址)
- `KIMAGE_VADDR = MODULES_END`(编译时预期虚拟加载地址)

**如何确定**:
```bash
# 在运行系统中:
cat /proc/kallsyms | head -1
# 0000000000000000 T _text   ← KASLR 关闭时

# 或:
sudo dmesg | grep "KASLR"
# [    0.000000] KASLR disabled
# 或带偏移:
# [    0.000000] KASLR offset: 0x80000
```

**举例**(KASLR 偏移 0x80000):
```bash
crash_arm64 -m kaslr=0x80000 ...
```

**注意**:KASLR 关闭时此值为 0。

---

## 3. 完整推导实例

> **核心引用**:[Kernel panic 实验室 - Crash 分析中关键地址参数的含义](https://mp.weixin.qq.com/s/UPI8j-GacIPFStX_dbNP9Q) 中给出的标准示例。

**场景**:某 ARM64 平台
- `VA_BITS` = 39
- `phys_offset` = `0x80000000`(DDR 物理起始)
- 预期虚拟加载地址 = `0xffffffc080000000`(= `MODULES_END`)
- KASLR 偏移 = `0x80000`

**推导过程**:

```
kimage_vaddr = 0xffffffc080000000 + 0x80000
     

Sponsored

Ads related to linux-kernel-crash-debug and adjacent AI workflows.