Skip to content

KVM: x86: Fix an FPU+CET splat

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Applied to kvm-x86 fixes, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: x86: Unload "FPU" state on INIT if and only if its currently in-usearch/x86/kvm/x86.c+15 -101 reply
2/2KVM: x86: Harden KVM against imbalanced load/put of guest FPU statearch/x86/kvm/x86.c+6 -01 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchYao YuanChao Gao
SeriesR-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] KVM: x86: Fix an FPU+CET splat

Fix a explosion found via syzkaller+KASAN where KVM attempts to "put" an FPU without first having loading the FPU. The underlying problem is the ugly hack for dealing with INIT being processed during MP_STATE.

KVM needs to ensure the FPU state is resident in memory in order to clear MPX and CET state. In most cases, INIT is emulated during KVM_RUN, and so KVM needs to put the FPU. But for MP_STATE, the FPU doesn't need to be loaded, and so isn't. Except when KVM predicts that the FPU will be unloaded. CET enabling updated the "put" path but missed the prediction logic in MP_STATE.

Rip out the ugly hack and instead do the obvious-in-hindsight thing of checking if the FPU is loaded (or not). To retain a sanity check, e.g. that the FPU is loaded as expected during KVM_RUN, WARN if the FPU being loaded and the vCPU wanting to run aren't equal.

Sean Christopherson (2):
KVM: x86: Unload "FPU" state on INIT if and only if its currently
in-use
KVM: x86: Harden KVM against imbalanced load/put of guest FPU state

 arch/x86/kvm/x86.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

base-commit: 4361f5aa8bfcecbab3fc8db987482b9e08115a6a

Signature · 1 line
2.51.1.930.gacf6e81ea2-goog