[PATCH] KVM: arm64: Validate the SVE vector length in pkvm_vcpu_init_sve()

Marc Zyngier maz at kernel.org
Tue Aug 18 05:51:24 PDT 2026


On Tue, 18 Aug 2026 10:31:17 +0100,
Fuad Tabba <fuad.tabba at linux.dev> wrote:
> 
> pkvm_vcpu_init_sve() clamps only the upper bound of the host-provided
> sve_max_vl, so an invalid vector length reaches sve_state_size_from_vl()
> and the WARN_ON() there, which is fatal at EL2. The existing
> !sve_state_size test rejects such a length, but only after the macro has
> run.
> 
> Check sve_vl_valid() before deriving the state size. A valid length
> cannot yield a zero size, so the !sve_state_size test goes with it.
> 
> Fixes: 5db1bef93342 ("KVM: arm64: Track SVE state in the hypervisor vcpu structure")
> Reported-by: Stefan Teodorescu <fane at google.com>
> Signed-off-by: Fuad Tabba <fuad.tabba at linux.dev>

Reviewed-by: Marc Zyngier <maz at kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list