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

Nam Cao namcao at linutronix.de
Fri Jun 19 02:51:28 PDT 2026


Jiakai Xu <xujiakai2025 at iscas.ac.cn> 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



More information about the linux-riscv mailing list