summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Elisei <alexandru.elisei@arm.com>2025-12-16 13:30:51 +0300
committerOliver Upton <oupton@kernel.org>2026-01-08 23:56:17 +0300
commitaba963cb98c6d9d42490262a39c3d383cfebc6a9 (patch)
tree10c7efd18ec725833de6fea98d9b822a59e49aed
parent145cc42fe1217c66174c44c4034cc0fe3040bbb0 (diff)
downloadlinux-aba963cb98c6d9d42490262a39c3d383cfebc6a9.tar.xz
KVM: arm64: Inject UNDEF for a register trap without accessor
Configuring a register trap without specifying an accessor function is abviously a bug. Instead of calling die() when that happens, let's be a bit more helpful and print the register encoding. Also inject an undefined instruction exception in the guest, similar to other unhandled register accesses. Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Reviewed-by: Marc Zyngier <maz@kernel.org> Tested-by: Fuad Tabba <tabba@google.com> Reviewed-by: Fuad Tabba <tabba@google.com> Link: https://msgid.link/20251216103053.47224-3-alexandru.elisei@arm.com Signed-off-by: Oliver Upton <oupton@kernel.org>
-rw-r--r--arch/arm64/kvm/sys_regs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index c8fd7c6a12a1..88a57ca36d96 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -4668,7 +4668,10 @@ static void perform_access(struct kvm_vcpu *vcpu,
* that we don't know how to handle. This certainly qualifies
* as a gross bug that should be fixed right away.
*/
- BUG_ON(!r->access);
+ if (!r->access) {
+ bad_trap(vcpu, params, r, "register access");
+ return;
+ }
/* Skip instruction if instructed so */
if (likely(r->access(vcpu, params, r)))