From: Nam Cao <namcao@linutronix.de>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Samuel Holland <samuel.holland@sifive.com>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] riscv: Fix kernel crash due to PR_SET_TAGGED_ADDR_CTRL
Date: Mon, 5 May 2025 18:07:22 +0200 [thread overview]
Message-ID: <20250505160722.s_w3u1pd@linutronix.de> (raw)
In-Reply-To: <c59f2632-d96f-43c6-869d-5e5f743f2dbd@ghiti.fr>
Hi Alex,
On Mon, May 05, 2025 at 06:02:26PM +0200, Alexandre Ghiti wrote:
> On 04/05/2025 12:19, Nam Cao wrote:
> > When userspace does PR_SET_TAGGED_ADDR_CTRL, but Supm extension is not
> > available, the kernel crashes:
> >
> > Oops - illegal instruction [#1]
> > [snip]
> > epc : set_tagged_addr_ctrl+0x112/0x15a
> > ra : set_tagged_addr_ctrl+0x74/0x15a
> > epc : ffffffff80011ace ra : ffffffff80011a30 sp : ffffffc60039be10
> > [snip]
> > status: 0000000200000120 badaddr: 0000000010a79073 cause: 0000000000000002
> > set_tagged_addr_ctrl+0x112/0x15a
> > __riscv_sys_prctl+0x352/0x73c
> > do_trap_ecall_u+0x17c/0x20c
> > andle_exception+0x150/0x15c
>
>
> It seems like the csr write is triggering this illegal instruction, can you
> confirm it is?
Yes, it is the "csr_write(CSR_ENVCFG, envcfg);" in envcfg_update_bits().
> If so, I can't find in the specification that an implementation should do
> that when writing envcfg and I can't reproduce it on qemu. Where did you
> see this oops?
I can't find it in the spec either. I think it is up to the implementation.
I got this crash on the MangoPI board:
https://mangopi.org/mqpro
Best regards,
Nam
next prev parent reply other threads:[~2025-05-05 16:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-04 10:19 [PATCH] riscv: Fix kernel crash due to PR_SET_TAGGED_ADDR_CTRL Nam Cao
2025-05-05 16:02 ` Alexandre Ghiti
2025-05-05 16:07 ` Nam Cao [this message]
2025-05-05 19:27 ` Alexandre Ghiti
2025-05-06 16:31 ` Alexandre Ghiti
2025-05-06 22:29 ` Samuel Holland
2025-05-07 18:05 ` Nam Cao
2025-05-08 16:52 ` patchwork-bot+linux-riscv
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=20250505160722.s_w3u1pd@linutronix.de \
--to=namcao@linutronix.de \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=stable@vger.kernel.org \
/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