[PW_SID:1081443] RISC-V: KVM: Fix invalid HVA warning in steal-time recording#1772
[PW_SID:1081443] RISC-V: KVM: Fix invalid HVA warning in steal-time recording#1772linux-riscv-bot wants to merge 1 commit into
Conversation
kvm_riscv_vcpu_record_steal_time() assumes that the steal-time shared memory GPA (vcpu->arch.sta.shmem) is always backed by a valid guest memory slot. However, this assumption is not guaranteed by the KVM userspace ABI. A malicious or buggy userspace can set the STA shared memory GPA via KVM_SET_ONE_REG without establishing a corresponding memory region via KVM_SET_USER_MEMORY_REGION. In such cases, the GPA cannot be translated to a valid HVA and kvm_vcpu_gfn_to_hva() returns an error address. The current implementation incorrectly treats this as a kernel warning using WARN_ON(), which may escalate to a kernel panic when panic_on_warn is enabled. This is not a kernel bug condition but a normal invalid configuration from userspace, and should be handled gracefully. Fix it by removing WARN_ON() and treating invalid HVA as a normal failure case, resetting the STA shared memory state. Fixes: e9f12b5 ("RISC-V: KVM: Implement SBI STA extension") Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com> Assisted-by: OpenClaw:DeepSeek-V3.2 Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
|
Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording" |
PR for series 1081443 applied to workflow__riscv__fixes
Name: RISC-V: KVM: Fix invalid HVA warning in steal-time recording
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1081443
Version: 1