> x86/unwind: Add Minimal DWARF CFI kernel unwinder TL;DR: Nits only in the DWARF CFI unwinder: unwind_module_init() is reused with NULL/0 placeholders, where a dedicated init hook may be cleaner, and the get_scratch_reg() prev_regs fallback looks unreachable. > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c [ ... ] > @@ -299,14 +301,19 @@ int module_finalize(const Elf_Ehdr *hdr, > - if (orc && orc_ip) > + if (IS_ENABLED(CONFIG_UNWINDER_ORC) && orc && orc_ip) > unwind_module_init(me, (void *)orc_ip->sh_addr, orc_ip->sh_size, > (void *)orc->sh_addr, orc->sh_size); > + if (IS_ENABLED(CONFIG_UNWINDER_DWARF_CFI) && eh_frame && > + (eh_frame->sh_flags & SHF_ALLOC) && eh_frame->sh_addr) > + unwind_module_init(me, /*orc_ip=*/NULL, /*orc_ip_size=*/0, > + (void *)eh_frame->sh_addr, eh_frame->sh_size); this isn't a bug, but the DWARF path reuses the ORC prototype of unwind_module_init(), so it passes NULL/0 placeholders for orc_ip and orc_ip_size and hands .eh_frame in through the parameters named orc and orc_size. The two branches are already separate IS_ENABLED() tests, so the shared prototype doesn't save anything at the call site. Could the DWARF path get its own init hook, for example one taking (mod, eh_frame, eh_frame_size), alongside the new unwind_module_cleanup()? [ ... ] > diff --git a/arch/x86/kernel/unwind_dwarf.c b/arch/x86/kernel/unwind_dwarf.c > --- /dev/null > +++ b/arch/x86/kernel/unwind_dwarf.c [ ... ] > +static bool get_scratch_reg(struct unwind_state *state, u8 dwarf_reg, > + unsigned long *val) > +{ > + struct pt_regs *regs = state->full_regs ? state->regs : state->prev_regs; this isn't a bug, but is the state->prev_regs fallback in get_scratch_reg() reachable? Nothing in unwind_dwarf.c sets prev_regs to anything other than NULL (__unwind_start() memsets the state, and unwind_next_frame() only stores NULL into it), and full_regs is only set where state->regs is also set. Could this use state->full_regs ? state->regs : NULL and drop the prev_regs = NULL stores in unwind_next_frame()? The kernel-doc also says the register is recovered "from full pt_regs", which doesn't match the prev_regs fallback. --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45561209846