KVM: arm64: Bound used_lrs when flushing the pKVM hyp vCPU
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
KVM: arm64: Bound used_lrs when flushing the pKVM hyp vCPU
flush_hyp_vcpu() copies the host vGIC state into the hyp's private vCPU on every run. The vGIC list register save and restore use used_lrs as their loop bound and expect it to stay within the number of implemented list registers. While this is generally the case, flush_hyp_vcpu() copies vgic_v3 verbatim and does not enforce this, so a value provided by the host is used at EL2 to index vgic_lr[] and access ICH_LR<n>_EL2 (host -> EL2).
Fix by clamping used_lrs to the number of implemented list registers after the copy, as the trusted path already does in vgic_flush_lr_state(). The number of implemented list registers is constant after init, so it is replicated once from kvm_vgic_global_state.nr_lr into hyp_gicv3_nr_lr rather than read on every entry.
From the CVE record · Linux
The Linux kernel's KVM arm64 pKVM path copies host vGIC state into a private hypervisor vCPU without bounding used_lrs. A host-provided value can cause out-of-bounds indexing of vgic_lr[] and access to ICH_LR<n>_EL2 when the vCPU is flushed. The input does not specify authentication requirements or user interaction.
Engineers running the Linux kernel with KVM arm64 pKVM should check their kernel; affected versions are not specified.