Re: [PATCH 2/2] KVM: x86: Harden KVM against imbalanced load/put of guest FPU state

From: Chao Gao
Date: Tue Nov 04 2025 - 01:08:17 EST


On Thu, Oct 30, 2025 at 11:58:02AM -0700, Sean Christopherson wrote:
>Assert, via KVM_BUG_ON(), that guest FPU state isn't/is in use when
>loading/putting the FPU to help detect KVM bugs without needing an assist
>from KASAN. If an imbalanced load/put is detected, skip the redundant
>load/put to avoid clobbering guest state and/or crashing the host.
>
>Note, kvm_access_xstate_msr() already provides a similar assertion.
>
>Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Reviewed-by: Chao Gao <chao.gao@xxxxxxxxx>