* Re: [PATCH 7.2 046/281] RISC-V: Clear HSTATUS.HU on CPU initialization
[not found] <20261013112856.169944981@linuxfoundation.org>
@ 2026-10-13 13:05 ` Miguel Ojeda
0 siblings, 0 replies; only message in thread
From: Miguel Ojeda @ 2026-10-13 13:05 UTC (permalink / raw)
To: gregkh
Cc: patches, pjw, samuel.holland, stable, yongxuan.wang,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-riscv
On Tue, 13 Oct 2026 13:36:02 +0200 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>
> 7.2-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Yong-Xuan Wang <yongxuan.wang@sifive.com>
>
> commit 6694612317e5225086e39ca1ba97ada2b1942e48 upstream.
>
> The RISC-V privileged specification does not mandate HSTATUS reset
> values, leaving the HU bit potentially set after hardware reset.
> When HU=1, hypervisor instructions (HLV/HLVX/HSV) can execute in
> U-mode to access guest memory, which may cause unintended behavior
> if not explicitly controlled.
>
> Clear HSTATUS.HU during CPU initialization to ensure hypervisor
> instructions are only available in HS-mode, preventing unexpected
> guest memory access from U-mode code.
>
> Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
> Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
> Link: https://patch.msgid.link/20260924-hstatus_hu-v2-1-7e970f5f1d8d@sifive.com
> Cc: stable@vger.kernel.org
> [pjw@kernel.org: capitalized RISCV_ISA_EXT_h to fix build; added stable cc]
> Signed-off-by: Paul Walmsley <pjw@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For riscv64, I am seeing:
arch/riscv/kernel/cpufeature.c:1189:36: error: use of undeclared identifier 'RISCV_ISA_EXT_H'
1189 | if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_H))
| ^
It seems it is missing commit
0c5a9ab5192b ("riscv: Standardize extension capitalization")
Either that or manually tweak the identifier to match 7.2.y.
6.18.y also breaks for the same reason.
I hope this helps!
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: linux-riscv@lists.infradead.org
Cheers,
Miguel
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] only message in thread