[PATCH 0/2] KVM: arm64: vgic-v3: Fix redistributor region indices above 255
From: Raffaele Tranfaglia via B4 Relay
Date: Tue Dec 01 2026 - 03:30:23 EST
The index field of KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION is 12 bits wide,
but kvm_vgic_addr() keeps it in a u8, so indices from 256 upwards alias
indices 0 to 255. Reading region 256 returns region 0, the first region
can be registered with index 256, and region 256 can never be
registered.
Patch 1 keeps the index in a u32, the type the redistributor region
helpers already take.
Patch 2 extends the vgic_init selftest to cover index 256, which fails
without patch 1.
vgic_init passes with KVM in VHE and nVHE mode, in an arm64 guest of
QEMU TCG with virtualization=on and GICv3. It is not tested on
hardware, in protected mode, or with GICv2.
An AI coding assistant found this while reviewing the KVM/arm64 ioctl
paths with me, and helped me prepare these patches. I reviewed and
tested them myself.
---
Raffaele Tranfaglia (2):
KVM: arm64: vgic-v3: Don't truncate the redistributor region index
KVM: arm64: selftests: Test redistributor region indices above 255
arch/arm64/kvm/vgic/vgic-kvm-device.c | 2 +-
tools/testing/selftests/kvm/arm64/vgic_init.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261201-vgic-rdist-index-34b748750a10
Best regards,
--
Raffaele Tranfaglia <raffaele.tranfaglia@xxxxxxxxx>