arch_stack_walk(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 arch_stack_walk(9) β€” the Kernel API Manual, bestie edition 🌸

okay so this is arch_stack_walk(9) from the Kernel API Manual, and it's lowkey one of those pages that's short but loaded, yk? it's the arch-specific function that walks the stack. that's the whole vibe. stack walking, but make it architecture specific πŸ’…


✨ SYNOPSIS ✨

void arch_stack_walk (stack_trace_consume_fn consume_entry , void
*cookie , struct task_struct *task , struct pt_regs *regs );

like, yes, that's the whole signature. four args. no cap, that's it. 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • consume_entry β€” this is the callback, and the architecture code invokes it for each and every entry it finds. every single one. it's giving "main character energy" but for stack frames πŸ‘‘
  • cookie β€” a caller-supplied pointer that gets handed straight back to consume_entry. it's literally a little care package you give the callback. you pack it, you get it back πŸ“
  • task β€” pointer to a task_struct. and yes, it can be NULL. no pressure.
  • regs β€” pointer to registers. also can be NULL. the bar is on the floor and honestly? we respect it πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so the page draws this adorable little grid, and I'm gonna reproduce it character for character because it's iconic in a chaotic way:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ task   regs     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
task         NULL    Stack trace from task (can be current) current
regs    Stack trace starting on regs->stackpointer

the way that box is just sitting there holding task and regs like two little labels 🧚 and then the lines underneath are doing the actual explainer work:

  • task with NULL β†’ stack trace from task (and the task can be current, fr fr)
  • regs β†’ stack trace starting on regs->stackpointer ⭐

that's the whole description. short, sweet, slays, done. periodt.


🌈 SEE ALSO 🌈

  • the Kernel file ./include/linux/stacktrace.h β€” go read it, it's literally right there πŸ“
  • stack_trace_consume_fn(9) β€” the callback type from the arguments, bestie, look it up πŸ’œ
  • arch_stack_walk_reliable(9) β€” the reliable sibling. yes, the naming is a little shady, no, we're not gonna talk about it πŸ™ˆ

ngl, if you're here you're probably debugging something cursed. good luck. you got this. πŸ’–

and that's the page!! cute little sign-off for you: it comes from the source/version ./include/linux, dated October 2026, and the footer is literally just arch_stack_walk(9) again because manpages love a callback. mwah πŸ˜­πŸ’…πŸ”₯

πŸ“¦ where this page comes from