Re: [PATCH 3/7] KVM: arm64: Validate the host-provided vgic model in pKVM

From: Fuad Tabba

Date: Wed Sep 16 2026 - 07:43:20 EST


Hi Joey,

On Wed, 16 Sept 2026 at 12:00, Joey Gouly <joey.gouly@xxxxxxx> wrote:
[...]
> > + if (vgic_model != KVM_DEV_TYPE_ARM_VGIC_V3)
> > + vgic_model = 0;
> > + hyp_vm->kvm.arch.vgic.vgic_model = vgic_model;
>
> A bit confused by what is expected by writing 0 here? I would have maybe
> expected to refuse running this VM? What happens if the host writes some
> garbage here, so vgic_model=0, but then tries to access gic-v3
> registers?

0 is vgic_model for a VM with no in-kernel irqchip, which pKVM runs.
An unsupported model is treated the same, as a protected VM's features
are masked rather than rejected.

At EL2 the model only selects the GICv5 world-switch path (GICv3 is
saved and restored under the gicv3_cpuif static key) and gates
__vgic_v3_perform_cpuif_access(), which returns 0 for anything but V3
and leaves a trapped ICC_* access to the host. A host that writes a
model it doesn't have gets a guest without a working GIC, which it can
do anyway, but can't make EL2 run the GICv5 path on a GICv3 machine.

I'll say so in the comment if I respin.

Cheers,
/fuad