Re: [PATCH v2] riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe()

From: Nam Cao

Date: Fri Jun 19 2026 - 05:52:49 EST


Jiakai Xu <xujiakai2025@xxxxxxxxxxx> writes:
> + if (!task)
> + task = current;
> +
> + high = (unsigned long)task_pt_regs(task);

I am concerned when CONFIG_IRQ_STACKS=y and we are on the irq stack,
wouldn't this "high" be the wrong one?

I haven't validated it, we probably need something like

if (on_thread_stack()) {
if (!task)
task = current;
high = (unsigned long)task_pt_regs(task);
} else {
high = per_cpu(irq_stack_ptr, smp_processor_id()) + IRQ_STACK_SIZE/sizeof(ulong);
}

Nam