Skip to content

[PW_SID:1081443] RISC-V: KVM: Fix invalid HVA warning in steal-time recording#1772

Closed
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1081443
Closed

[PW_SID:1081443] RISC-V: KVM: Fix invalid HVA warning in steal-time recording#1772
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1081443

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

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

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>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 136.51 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1022.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1376.60 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 24.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 25.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.80 seconds
Result: ERROR
Output:

WARNING: Non-standard signature: Assisted-by:
#29: 
Assisted-by: OpenClaw:DeepSeek-V3.2

ERROR: Unrecognized email address: 'OpenClaw:DeepSeek-V3.2'
#29: 
Assisted-by: OpenClaw:DeepSeek-V3.2

total: 1 errors, 1 warnings, 0 checks, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 67cc09bea5dd ("RISC-V: KVM: Fix invalid HVA warning in steal-time recording") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
ERROR: Unrecognized email address: 'OpenClaw:DeepSeek-V3.2'
WARNING: Non-standard signature: Assisted-by:


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.01 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
kdoc
Desc: Detects for kdoc errors
Duration: 0.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "RISC-V: KVM: Fix invalid HVA warning in steal-time recording"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1081443 branch April 23, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants