Skip to content

Commit 07f557f

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: nv: Properly check ESR_EL2.VNCR on taking a VNCR_EL2 related fault
Instead of checking for the ESR_EL2.VNCR bit being set (the only case we should be here), we are actually testing random bits in ESR_EL2.DFSC. 13 obviously being a lucky number, it matches both permission and translation fault status codes, which explains why we never saw it failing. This was found by inspection, while reviewing a vaguely related patch. Whilst we're at it, turn the BUG_ON() into a WARN_ON_ONCE(), as exploding here is just silly. Fixes: 069a05e ("KVM: arm64: nv: Handle VNCR_EL2-triggered faults") Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Joey Gouly <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 7b8346b commit 07f557f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kvm/nested.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ int kvm_handle_vncr_abort(struct kvm_vcpu *vcpu)
12871287
struct vncr_tlb *vt = vcpu->arch.vncr_tlb;
12881288
u64 esr = kvm_vcpu_get_esr(vcpu);
12891289

1290-
BUG_ON(!(esr & ESR_ELx_VNCR_SHIFT));
1290+
WARN_ON_ONCE(!(esr & ESR_ELx_VNCR));
12911291

12921292
if (esr_fsc_is_permission_fault(esr)) {
12931293
inject_vncr_perm(vcpu);

0 commit comments

Comments
 (0)