[PATCH] riscv: cpufeature: remove _RO from use_hcontext for KVM=m

From: Jun Sun

Date: Tue Jun 09 2026 - 14:34:31 EST


use_hcontext is in __ro_after_init but only referenced from KVM's
__jump_table. With KVM=m, jump_label_init_ro() never sees it, so
it is never sealed. Module load then tries to write to the RO key
in jump_label_add_module() and oopses.
---
arch/riscv/kernel/cpufeature.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index 903e27cf908f..3a68d20156e8 100644
--- a/arch/riscv/kernel/cpufeature.c
+++ b/arch/riscv/kernel/cpufeature.c
@@ -49,7 +49,7 @@ u32 thead_vlenb_of;
atomic_t hcontext_disable;
atomic_t scontext_disable;

-DEFINE_STATIC_KEY_FALSE_RO(use_hcontext);
+DEFINE_STATIC_KEY_FALSE(use_hcontext);
EXPORT_SYMBOL(use_hcontext);

DEFINE_STATIC_KEY_FALSE_RO(use_scontext);
--
2.34.1