Versioned kernel debugging
Quick answer
Kernel debugging starts with a reproducible symptom and evidence tied to the exact build. A stack trace identifies an observed call path, not necessarily the cause. Preserve the release, build identity, configuration, matching symbols and the sequence of events before changing the environment.
Two builds may report similar release strings yet have different symbol addresses. Associate a trace with the exact binary and debug symbols before interpreting addresses. Record the smallest reproducer and preserve the original evidence separately from annotations.
Prepare the practice environment
Run python3 lab-fixtures/advanced-kernel/setup.py from the extracted root as an ordinary user. Enter the printed private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. The helper reads fictional records. No root, external network, module load or BPF attachment is required. Optional hardware inspection requires an authorized VM.
Prerequisites
Review: eBPF observability foundations.
How it works
An oops reports a kernel fault; a panic can halt or restart the system depending on settings. Warnings may reveal violated assumptions without an immediate halt. Collect authorized logs (dmesg or a journal where available), exact kernel/package build, architecture, taint state and reproduction steps. Do not assume a taint flag proves a particular cause. Unstripped vmlinux, matching module debug files and source for the exact build help decode stack frames; distribution patches, optimization, relocation and KASLR can affect addresses. Never mix symbols merely because the version prefix matches. Tools such as scripts/decode_stacktrace.sh, scripts/faddr2line or a debugger require appropriate artifacts; a crash dump requires configured capture and can contain sensitive memory. Redact secrets before sharing evidence. Compare known-good and failing builds under controlled conditions; a bisect narrows candidate changes if the test is reliable, but does not prove the final cause. The lab uses invented warning records and metadata, not real faults or memory dumps. No kernel fault is deliberately triggered.
Try the examples
test "$(uname -r)" = "$(cat /proc/sys/kernel/osrelease)" && printf 'release agrees\n'Cross-checks two interfaces for the current release, not build identity.
Expected stdout:
release agreesThe second artifact shares the release but has a different build ID. The modeled matching gate is necessary but not a full symbol validation.
Expected stdout:
match: release, architecture, build IDreject: build ID differsThe helper reports only the observed warning and a frame; no actual fault is inferred.
Expected stdout:
warning at demo_read+0x20/0x60frame: demo_dispatchroot cause: not establishedCommon mistakes
Do not decode a trace with mismatched symbols or declare the first stack frame the root cause. Do not trigger crashes, disable address randomization or share raw memory dumps for this lab.
Practice
Review debug.json and kernel.log. Separate observations from hypotheses, reject the mismatched symbol record, and propose an isolated reproduction with one controlled change and a recovery plan.
Related references
Study: dmesg, perf. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Versioned kernel debugging — Knowledge Check
Apply kernel engineering concepts to concrete local examples.
Which symbol file is appropriate?
What does a stack frame establish?
Why protect crash dumps?
What does reliable bisecting do?