The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nam Cao <namcao@linutronix.de>
To: Jiakai Xu <xujiakai2025@iscas.ac.cn>,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Cc: Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Chunyan Zhang <zhangchunyan@iscas.ac.cn>,
	Jiakai Xu <xujiakai2025@iscas.ac.cn>,
	Matthew Bystrin <dev.mbstr@gmail.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <pjw@kernel.org>,
	Samuel Holland <samuel.holland@sifive.com>
Subject: Re: [PATCH v2] riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe()
Date: Fri, 19 Jun 2026 11:51:28 +0200	[thread overview]
Message-ID: <87zf0q504f.fsf@yellow.woof> (raw)
In-Reply-To: <20260517143704.659416-1-xujiakai2025@iscas.ac.cn>

Jiakai Xu <xujiakai2025@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

      parent reply	other threads:[~2026-06-19  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17 14:37 [PATCH v2] riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe() Jiakai Xu
2026-05-18 20:37 ` Matthew Bystrin
2026-06-19  9:11   ` Nam Cao
2026-06-12  1:41 ` Jiakai Xu
2026-06-19  9:51 ` Nam Cao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zf0q504f.fsf@yellow.woof \
    --to=namcao@linutronix.de \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=dev.mbstr@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=xujiakai2025@iscas.ac.cn \
    --cc=zhangchunyan@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox