linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: KVM: Do not inject a 64bit fault for a 32bit guest
@ 2015-08-27 14:05 Marc Zyngier
  2015-08-27 14:45 ` Russell King - ARM Linux
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2015-08-27 14:05 UTC (permalink / raw)
  To: linux-arm-kernel

When injecting a fault into a 32bit guest, it seems rather idiotic
to also inject a 64bit fault that is only going to corrupt the
guest state, and lead to a situation where we restore an illegal
context.

Just fix the stupid bug that has been there from day 1.

Cc: stable at vger.kernel.org
Reported-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
Will: Paolo being on holiday, do you mind merging this one
via your tree?

Thanks,

	M.

 arch/arm64/kvm/inject_fault.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
index f02530e..85c5715 100644
--- a/arch/arm64/kvm/inject_fault.c
+++ b/arch/arm64/kvm/inject_fault.c
@@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr)
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_abt32(vcpu, false, addr);
-
-	inject_abt64(vcpu, false, addr);
+	else
+		inject_abt64(vcpu, false, addr);
 }
 
 /**
@@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr)
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_abt32(vcpu, true, addr);
-
-	inject_abt64(vcpu, true, addr);
+	else
+		inject_abt64(vcpu, true, addr);
 }
 
 /**
@@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_undef32(vcpu);
-
-	inject_undef64(vcpu);
+	else
+		inject_undef64(vcpu);
 }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] arm64: KVM: Do not inject a 64bit fault for a 32bit guest
  2015-08-27 14:05 [PATCH] arm64: KVM: Do not inject a 64bit fault for a 32bit guest Marc Zyngier
@ 2015-08-27 14:45 ` Russell King - ARM Linux
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2015-08-27 14:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Aug 27, 2015 at 03:05:47PM +0100, Marc Zyngier wrote:
> When injecting a fault into a 32bit guest, it seems rather idiotic
> to also inject a 64bit fault that is only going to corrupt the
> guest state, and lead to a situation where we restore an illegal
> context.
> 
> Just fix the stupid bug that has been there from day 1.
> 
> Cc: stable at vger.kernel.org
> Reported-by: Russell King <linux@arm.linux.org.uk>

s/linux/rmk+kernel/ please

Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>

> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> Will: Paolo being on holiday, do you mind merging this one
> via your tree?

I don't think the commit message does this bug justice.  The implication
is it's just a guest issue.  It isn't, the bug appears to take out the
host kernel in a truely spectacular way.

http://www.arm.linux.org.uk/developer/build/result.php?type=boot&idx=4871

Tested here, the fix stops the host kernel exploding.  The crashed kvm
instance can be stopped and a proper kernel can then be booted in a new
guest instance.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-27 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27 14:05 [PATCH] arm64: KVM: Do not inject a 64bit fault for a 32bit guest Marc Zyngier
2015-08-27 14:45 ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).