public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel•org>
To: linux-arm-kernel@lists•infradead.org,
	kvmarm@lists•cs.columbia.edu, kvm@vger•kernel.org
Cc: "Julien Grall" <julien@xen•org>,
	"Suzuki K Poulose" <suzuki.poulose@arm•com>,
	"André Przywara" <andre.przywara@arm•com>,
	stable@vger•kernel.org, "Eric Auger" <eric.auger@redhat•com>,
	"James Morse" <james.morse@arm•com>,
	"Zenghui Yu" <yuzenghui@huawei•com>,
	"Julien Thierry" <julien.thierry.kdev@gmail•com>
Subject: [PATCH v2 1/6] KVM: arm: vgic: Fix limit condition when writing to GICD_I[CS]ACTIVER
Date: Fri, 17 Apr 2020 09:33:14 +0100	[thread overview]
Message-ID: <20200417083319.3066217-2-maz@kernel.org> (raw)
In-Reply-To: <20200417083319.3066217-1-maz@kernel.org>

When deciding whether a guest has to be stopped we check whether this
is a private interrupt or not. Unfortunately, there's an off-by-one bug
here, and we fail to recognize a whole range of interrupts as being
global (GICv2 SPIs 32-63).

Fix the condition from > to be >=.

Cc: stable@vger•kernel.org
Fixes: abd7229626b93 ("KVM: arm/arm64: Simplify active_change_prepare and plug race")
Reported-by: André Przywara <andre.przywara@arm•com>
Signed-off-by: Marc Zyngier <maz@kernel•org>
---
 virt/kvm/arm/vgic/vgic-mmio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
index 2199302597fa..d085e047953f 100644
--- a/virt/kvm/arm/vgic/vgic-mmio.c
+++ b/virt/kvm/arm/vgic/vgic-mmio.c
@@ -444,7 +444,7 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
 static void vgic_change_active_prepare(struct kvm_vcpu *vcpu, u32 intid)
 {
 	if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
-	    intid > VGIC_NR_PRIVATE_IRQS)
+	    intid >= VGIC_NR_PRIVATE_IRQS)
 		kvm_arm_halt_guest(vcpu->kvm);
 }
 
@@ -452,7 +452,7 @@ static void vgic_change_active_prepare(struct kvm_vcpu *vcpu, u32 intid)
 static void vgic_change_active_finish(struct kvm_vcpu *vcpu, u32 intid)
 {
 	if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
-	    intid > VGIC_NR_PRIVATE_IRQS)
+	    intid >= VGIC_NR_PRIVATE_IRQS)
 		kvm_arm_resume_guest(vcpu->kvm);
 }
 
-- 
2.26.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-17  8:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  8:33 [PATCH v2 0/6] KVM: arm: vgic fixes for 5.7 Marc Zyngier
2020-04-17  8:33 ` Marc Zyngier [this message]
2020-04-17  8:33 ` [PATCH v2 2/6] KVM: arm: vgic: Synchronize the whole guest on GIC{D, R}_I{S, C}ACTIVER read Marc Zyngier
2020-04-17 16:26   ` [PATCH v2 2/6] KVM: arm: vgic: Synchronize the whole guest on GIC{D,R}_I{S,C}ACTIVER read André Przywara
2020-04-17  8:33 ` [PATCH v2 3/6] KVM: arm: vgic: Only use the virtual state when userspace accesses enable bits Marc Zyngier
2020-04-17 11:17   ` James Morse
2020-04-17  8:33 ` [PATCH v2 4/6] KVM: arm: vgic-v2: Only use the virtual state when userspace accesses pending bits Marc Zyngier
2020-04-17 11:22   ` James Morse
2020-04-17 12:41     ` Marc Zyngier
2020-04-17 16:48       ` James Morse
2020-04-20 10:03         ` Marc Zyngier
2020-04-22 15:55           ` James Morse
2020-04-22 16:02             ` Marc Zyngier
2020-04-17  8:33 ` [PATCH v2 5/6] KVM: arm64: vgic-v3: Retire all pending LPIs on vcpu destroy Marc Zyngier
2020-04-17  8:33 ` [PATCH v2 6/6] KVM: arm64: vgic-its: Fix memory leak on the error path of vgic_add_lpi() Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200417083319.3066217-2-maz@kernel.org \
    --to=maz@kernel$(echo .)org \
    --cc=andre.przywara@arm$(echo .)com \
    --cc=eric.auger@redhat$(echo .)com \
    --cc=james.morse@arm$(echo .)com \
    --cc=julien.thierry.kdev@gmail$(echo .)com \
    --cc=julien@xen$(echo .)org \
    --cc=kvm@vger$(echo .)kernel.org \
    --cc=kvmarm@lists$(echo .)cs.columbia.edu \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=stable@vger$(echo .)kernel.org \
    --cc=suzuki.poulose@arm$(echo .)com \
    --cc=yuzenghui@huawei$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox