[PATCH 00/10] vmcore-tasks: lightweight task and backtrace extractor for vmcore files
Pnina Feder
pnina.feder at mobileye.com
Mon Jun 22 13:54:38 PDT 2026
This series adds vmcore-tasks, a new userspace tool for extracting
per-task debugging information from Linux vmcore (kdump) files. It is
designed as a lightweight tool, targeting embedded
systems where crash-utility may not be available.
Motivation
----------
After a kernel panic, kdump produces a vmcore containing a full memory
snapshot. Existing post-mortem tools like crash-utility are
powerful but heavyweight — they require vmlinux with DWARF debug info
and a matching kernel symbol table. On embedded targets with limited
storage, stripped kernels, or unsupported architectures, this is often
not practical.
vmcore-tasks takes a different approach: it requires no vmlinux or
DWARF data. Instead, a kernel-side component exports the necessary
struct offsets, sizes, and symbol addresses into the standard
vmcoreinfo note section. This data, already embedded in the vmcore
by kdump, is sufficient to navigate kernel data structures,
allowing it to run directly from crash-kernel, and only solving
bt addresses later with tools like addr2line.
vmcore-tasks extract:
- Per-task register state (pt_regs) and user-space backtraces
- VMA memory maps with filename resolution via dentry walk
- Per-thread state for multi-threaded processes
- Kernel dmesg log (reuses existing vmcore-dmesg infrastructure)
Architecture
------------
The tool is structured in layers:
util_lib/ Foundation: vmcoreinfo parser, memory reader,
maple tree walker (reuses existing elf_info.c
and adds new shared utilities)
vmcore_tasks/ Core logic: task enumeration, VMA collection,
generic stack unwinder with arch callbacks
vmcore_tasks/arch/ Architecture backends: page table translation
and instruction decode (RISC-V 64, MIPS64)
The generic unwinder in unwind.c drives frame recovery using
arch-provided callbacks (detect SP adjustment, RA save, signal
trampolines), so adding a new architecture requires only implementing
the instruction decode — not the unwinding state machine.
VMA enumeration auto-selects between the legacy mm_struct->mmap
linked list (kernels < 6.1) and maple tree walk (kernels >= 6.1)
based on vmcoreinfo content.
Integration with kexec-tools
----------------------------
The new files are placed in vmcore_tasks/ and util_lib/.
The util_lib additions (vmcore_info.c, memory.c, maple_tree.c)
are currently built only by the vmcore_tasks Makefile.
Integration into the main kexec-tools build system can follow once
the tool matures.
The tool reuses elf_info.c from util_lib for ELF parsing and
paddr_to_offset() for physical-to-file-offset mapping, and reuses
dump_dmesg() from vmcore-dmesg for kernel log extraction.
Depends on kernel-side patch to export the needed vmcoreinfo values.
Will update with a link to this patch later.
Testing
-------
Validated against vmcore files from controlled kernel panic scenarios
on RISC-V 64-bit (SV39) and MIPS64 platforms, covering multi-frame
backtraces, leaf functions, and signal frame unwinding. Tested both
natively and cross-architecture (x86_64 host processing RISC-V/MIPS64
vmcores).
Pnina Feder (10):
util_lib: add paddr_to_offset function and expose raw vmcoreinfo data
util_lib: Add vmcoreinfo parser and memory reader
util_lib: Add maple tree walker for VMA enumeration
vmcore_tasks: Add common definitions and project infrastructure
vmcore_tasks: arch: Add RISC-V 64-bit architecture support
vmcore_tasks: arch: Add MIPS64 architecture support
vmcore_tasks: Add generic user-space stack unwinder
vmcore_tasks: Add VMA utilities and task enumeration
vmcore_tasks: Add main entry point and backtrace parser
vmcore_tasks: Add README with project documentation
util_lib/elf_info.c | 53 +-
util_lib/include/elf_info.h | 11 +-
util_lib/include/maple_tree.h | 137 ++++
util_lib/include/memory.h | 37 +
util_lib/include/vmcore_info.h | 72 ++
util_lib/include/vmcore_tasks_util.h | 62 ++
util_lib/maple_tree.c | 715 ++++++++++++++++++
util_lib/memory.c | 327 ++++++++
util_lib/vmcore_info.c | 382 ++++++++++
vmcore_tasks/Makefile | 103 +++
vmcore_tasks/README.md | 331 ++++++++
vmcore_tasks/arch/mips64/mips64.c | 648 ++++++++++++++++
vmcore_tasks/arch/mips64/mips64_defs.h | 78 ++
vmcore_tasks/arch/riscv64/riscv64.c | 327 ++++++++
vmcore_tasks/arch/riscv64/riscv64_defs.h | 127 ++++
vmcore_tasks/tasks.c | 540 +++++++++++++
vmcore_tasks/tasks.h | 53 ++
vmcore_tasks/unwind.c | 267 +++++++
vmcore_tasks/vma_util.c | 429 +++++++++++
vmcore_tasks/vma_util.h | 16 +
vmcore_tasks/vmcore_tasks.c | 182 +++++
vmcore_tasks/vmcore_tasks_backtrace_parser.py | 393 ++++++++++
vmcore_tasks/vmcore_tasks_defs.h | 124 +++
23 files changed, 5402 insertions(+), 12 deletions(-)
create mode 100644 util_lib/include/maple_tree.h
create mode 100644 util_lib/include/memory.h
create mode 100644 util_lib/include/vmcore_info.h
create mode 100644 util_lib/include/vmcore_tasks_util.h
create mode 100644 util_lib/maple_tree.c
create mode 100644 util_lib/memory.c
create mode 100644 util_lib/vmcore_info.c
create mode 100644 vmcore_tasks/Makefile
create mode 100644 vmcore_tasks/README.md
create mode 100644 vmcore_tasks/arch/mips64/mips64.c
create mode 100644 vmcore_tasks/arch/mips64/mips64_defs.h
create mode 100644 vmcore_tasks/arch/riscv64/riscv64.c
create mode 100644 vmcore_tasks/arch/riscv64/riscv64_defs.h
create mode 100644 vmcore_tasks/tasks.c
create mode 100644 vmcore_tasks/tasks.h
create mode 100644 vmcore_tasks/unwind.c
create mode 100644 vmcore_tasks/vma_util.c
create mode 100644 vmcore_tasks/vma_util.h
create mode 100644 vmcore_tasks/vmcore_tasks.c
create mode 100644 vmcore_tasks/vmcore_tasks_backtrace_parser.py
create mode 100644 vmcore_tasks/vmcore_tasks_defs.h
--
2.43.0
More information about the kexec
mailing list