diff options
author | Radim Krčmář <rkrcmar@ventanamicro.com> | 2025-04-03 13:25:24 +0200 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2025-05-01 18:26:14 +0530 |
commit | 87ec7d5249bb8ebf40261420da069fa238c21789 (patch) | |
tree | 7cce479079f8b04f8b2bac65b701e29079de5c21 | |
parent | b4432656b36e5cc1d50a1f2dc15357543add530e (diff) |
KVM: RISC-V: reset smstateen CSRs
Not resetting smstateen is a potential security hole, because VU might
be able to access state that VS does not properly context-switch.
Fixes: 81f0f314fec9 ("RISCV: KVM: Add sstateen0 context save/restore")
Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com>
Link: https://lore.kernel.org/r/20250403112522.1566629-8-rkrcmar@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
-rw-r--r-- | arch/riscv/kvm/vcpu.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index 60d684c76c58..02635bac91f1 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -77,6 +77,8 @@ static void kvm_riscv_reset_vcpu(struct kvm_vcpu *vcpu) memcpy(cntx, reset_cntx, sizeof(*cntx)); spin_unlock(&vcpu->arch.reset_cntx_lock); + memset(&vcpu->arch.smstateen_csr, 0, sizeof(vcpu->arch.smstateen_csr)); + kvm_riscv_vcpu_fp_reset(vcpu); kvm_riscv_vcpu_vector_reset(vcpu); |