[PATCH v1 0/7] KVM: arm64: Fix handling of host fpsimd/sve state in protected mode
Oliver Upton
oliver.upton at linux.dev
Fri May 17 10:30:54 PDT 2024
Hi Fuad,
On Fri, May 17, 2024 at 02:18:07PM +0100, Fuad Tabba wrote:
> With the KVM host data rework [1], handling of fpsimd and sve
> state in protected mode is done at hyp. For protected VMs, we
> don't want to leak any guest state to the host, including whether
> a guest has used fpsimd/sve.
>
> To complete the work started with the host data rework, in
> regards to protected mode, ensure that the host's fpsimd context
> and its sve context are restored on guest exit, since the rework
> has hidden the fpsimd/sve state from the host.
>
> This patch series eagerly restores the host fpsimd/sve state on
> guest exit when running in protected mode, which happens only if
> the guest has used fpsimd/sve. This means that the saving of the
> state is lazy, similar to the behavior of KVM in other modes, but
> the restoration of the host state is eager.
Hmm... Is there any reason why we need to be concerned about preserving
host SVE state?
The syscall ABI has it that only the first 128 bits of the vector
registers are preserved by the kernel, and I see no reason why we
couldn't apply a similar restriction to KVM_RUN HVCs into EL2. We'd need
to eagerly flush the vector registers on entry to avoid disclosing guest
usage of SVE.
What you have is certainly correct, I just wonder if we're going out of
our way to save/restore 0's for larger VLs.
--
Thanks,
Oliver
More information about the linux-arm-kernel
mailing list