From: "Radim Krčmář" <radim.krcmar@oss.qualcomm.com>
To: "Guodong Xu" <guodong.xu@oss.qualcomm.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Deepak Gupta" <debug@rivosinc.com>
Cc: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-riscv@lists.infradead.org>,
"Conor Dooley" <conor@kernel.org>,
"Charlie Jenkins" <thecharlesjenkins@gmail.com>,
"Andy Chiu" <tchiu@tenstorrent.com>,
"Anup Patel" <anup@brainfault.org>,
<kvm-riscv@lists.infradead.org>
Subject: Re: [PATCH] riscv: cfi: parse riscv_nousercfi before riscv_fill_hwcap()
Date: Wed, 18 Nov 2026 21:09:53 +0100 [thread overview]
Message-ID: <DMYLY5JOE18Z.2CQQGB4INJ4RH@oss.qualcomm.com> (raw)
In-Reply-To: <20261108-nousercfi-early-param-v1-1-ea22d3a60683@oss.qualcomm.com>
2026-11-08T04:42:01-05:00, Guodong Xu <guodong.xu@oss.qualcomm.com>:
> ISA bitmaps don't honour riscv_nousercfi because the ISA bitmaps are
> composed during setup_arch(), while riscv_nousercfi is a __setup()
> parameter, and those are parsed from start_kernel() after setup_arch()
> has returned.
>
> As a consequence, the riscv_nousercfi test in riscv_cfilp_validate() and
> riscv_cfiss_validate() always sees zero, and Zicfilp and Zicfiss stay in
> the ISA bitmaps even when user CFI is disabled on the kernel command
> line.
(I thought that was the intention.)
riscv_nousercfi definintely should disable the hwprobe reporting of
those features (my series did that), and prevent their enablement in
user-mode.
Why disable Zicfilp and Zicfiss in the ISA bitmaps by setting nousercfi,
though? Aren't the validate functions just misusing riscv_nousercfi
instead of defining a clear detection mechanism?
I think the ISA bitmaps should consider whether Linux has the
extensions, which with standard SBI means a successfuly executed FWFT
set/get.
Linux can then use the ISA bitmap to decide whether to use CFI for
kernel code, allow it in KVM guests, report it as available hardware
feature, or allow it in user mode.
nousercfi seems like it should only restrict use of CFI in user mode.
Thanks.
prev parent reply other threads:[~2026-11-18 20:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 9:42 Guodong Xu
2026-11-18 20:09 ` Radim Krčmář [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=DMYLY5JOE18Z.2CQQGB4INJ4RH@oss.qualcomm.com \
--to=radim.krcmar@oss.qualcomm.com \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=conor@kernel.org \
--cc=corbet@lwn.net \
--cc=debug@rivosinc.com \
--cc=guodong.xu@oss.qualcomm.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=tchiu@tenstorrent.com \
--cc=thecharlesjenkins@gmail.com \
/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
all inboxes | Powered by JetHome®