Skip to content

Commit 7b99369

Browse files
dwmw2gregkh
authored andcommitted
KVM: arm64: vgic: Fix IIDR revision field extracted from wrong value
commit a0e6ae4 upstream. The uaccess write handlers for GICD_IIDR in both GICv2 and GICv3 extract the revision field from 'reg' (the current IIDR value read back from the emulated distributor) instead of 'val' (the value userspace is trying to write). This means userspace can never actually change the implementation revision — the extracted value is always the current one. Fix the FIELD_GET to use 'val' so that userspace can select a different revision for migration compatibility. Fixes: 49a1a2c ("KVM: arm64: vgic-v3: Advertise GICR_CTLR.{IR, CES} as a new GICD_IIDR revision") Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Link: https://patch.msgid.link/20260407210949.2076251-2-dwmw2@infradead.org Signed-off-by: Marc Zyngier <maz@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 837db07 commit 7b99369

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

arch/arm64/kvm/vgic/vgic-mmio-v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int vgic_mmio_uaccess_write_v2_misc(struct kvm_vcpu *vcpu,
9191
* migration from old kernels to new kernels with legacy
9292
* userspace.
9393
*/
94-
reg = FIELD_GET(GICD_IIDR_REVISION_MASK, reg);
94+
reg = FIELD_GET(GICD_IIDR_REVISION_MASK, val);
9595
switch (reg) {
9696
case KVM_VGIC_IMP_REV_2:
9797
case KVM_VGIC_IMP_REV_3:

arch/arm64/kvm/vgic/vgic-mmio-v3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static int vgic_mmio_uaccess_write_v3_misc(struct kvm_vcpu *vcpu,
194194
if ((reg ^ val) & ~GICD_IIDR_REVISION_MASK)
195195
return -EINVAL;
196196

197-
reg = FIELD_GET(GICD_IIDR_REVISION_MASK, reg);
197+
reg = FIELD_GET(GICD_IIDR_REVISION_MASK, val);
198198
switch (reg) {
199199
case KVM_VGIC_IMP_REV_2:
200200
case KVM_VGIC_IMP_REV_3:

0 commit comments

Comments
 (0)