Skip to content

Commit 018f22f

Browse files
James MorseMarc Zyngier
authored andcommitted
KVM: arm: Fix DFSR setting for non-LPAE aarch32 guests
Beata reports that KVM_SET_VCPU_EVENTS doesn't inject the expected exception to a non-LPAE aarch32 guest. The host intends to inject DFSR.FS=0x14 "IMPLEMENTATION DEFINED fault (Lockdown fault)", but the guest receives DFSR.FS=0x04 "Fault on instruction cache maintenance". This fault is hooked by do_translation_fault() since ARMv6, which goes on to silently 'handle' the exception, and restart the faulting instruction. It turns out, when TTBCR.EAE is clear DFSR is split, and FS[4] has to shuffle up to DFSR[10]. As KVM only does this in one place, fix up the static values. We now get the expected: | Unhandled fault: lock abort (0x404) at 0x9c800f00 Fixes: 74a64a9 ("KVM: arm/arm64: Unify 32bit fault injection") Reported-by: Beata Michalska <[email protected]> Signed-off-by: James Morse <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cf2d23e commit 018f22f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

virt/kvm/arm/aarch32.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,12 @@ static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt,
181181

182182
/* Give the guest an IMPLEMENTATION DEFINED exception */
183183
is_lpae = (vcpu_cp15(vcpu, c2_TTBCR) >> 31);
184-
if (is_lpae)
184+
if (is_lpae) {
185185
*fsr = 1 << 9 | 0x34;
186-
else
187-
*fsr = 0x14;
186+
} else {
187+
/* Surprise! DFSR's FS[4] lives in bit 10 */
188+
*fsr = BIT(10) | 0x4; /* 0x14 */
189+
}
188190
}
189191

190192
void kvm_inject_dabt32(struct kvm_vcpu *vcpu, unsigned long addr)

0 commit comments

Comments
 (0)