]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Tighten handling of unknown FGT groups
authorMarc Zyngier <maz@kernel.org>
Sat, 26 Apr 2025 10:42:15 +0000 (11:42 +0100)
committerMarc Zyngier <maz@kernel.org>
Tue, 6 May 2025 16:35:09 +0000 (17:35 +0100)
triage_sysreg_trap() assumes that it knows all the possible values
for FGT groups, which won't be the case as we start adding more
FGT registers (unless we add everything in one go, which is obviously
undesirable).

At the same time, it doesn't offer much in terms of debugging info
when things go wrong.

Turn the "__NR_FGT_GROUP_IDS__" case into a default, covering any
unhandled value, and give the kernel hacker a bit of a clue about
what's wrong (system register and full trap descriptor).

Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/emulate-nested.c

index efe1eb3f1bd07932ea73768224e6ebb2765cc3a6..1bcbddc88a9b7bd615472addde64aa41c855ff8a 100644 (file)
@@ -2352,9 +2352,10 @@ bool triage_sysreg_trap(struct kvm_vcpu *vcpu, int *sr_index)
                }
                break;
 
-       case __NR_FGT_GROUP_IDS__:
+       default:
                /* Something is really wrong, bail out */
-               WARN_ONCE(1, "__NR_FGT_GROUP_IDS__");
+               WARN_ONCE(1, "Bad FGT group (encoding %08x, config %016llx)\n",
+                         sysreg, tc.val);
                goto local;
        }