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

Marc Zyngier <[email protected]>
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, 18 Aug 2026 10:31:17 +0100,
Fuad Tabba <[email protected]> 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 <[email protected]>
> Signed-off-by: Fuad Tabba <[email protected]>

Reviewed-by: Marc Zyngier <[email protected]>

	M.

-- 
Without deviation from the norm, progress is not possible.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.