Skip to content

Commit 126c69a

Browse files
Marc Zyngierwildea01
authored andcommitted
arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
When injecting a fault into a misbehaving 32bit guest, it seems rather idiotic to also inject a 64bit fault that is only going to corrupt the guest state. This leads to a situation where we perform an illegal exception return at EL2 causing the host to crash instead of killing the guest. Just fix the stupid bug that has been there from day 1. Cc: <[email protected]> Reported-by: Russell King <[email protected]> Tested-by: Russell King <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent c13dcf9 commit 126c69a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/arm64/kvm/inject_fault.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr)
168168
{
169169
if (!(vcpu->arch.hcr_el2 & HCR_RW))
170170
inject_abt32(vcpu, false, addr);
171-
172-
inject_abt64(vcpu, false, addr);
171+
else
172+
inject_abt64(vcpu, false, addr);
173173
}
174174

175175
/**
@@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr)
184184
{
185185
if (!(vcpu->arch.hcr_el2 & HCR_RW))
186186
inject_abt32(vcpu, true, addr);
187-
188-
inject_abt64(vcpu, true, addr);
187+
else
188+
inject_abt64(vcpu, true, addr);
189189
}
190190

191191
/**
@@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
198198
{
199199
if (!(vcpu->arch.hcr_el2 & HCR_RW))
200200
inject_undef32(vcpu);
201-
202-
inject_undef64(vcpu);
201+
else
202+
inject_undef64(vcpu);
203203
}

0 commit comments

Comments
 (0)