]> git.ipfire.org Git - thirdparty/linux.git/commit
x86/fpu: Initialize guest FPU permissions from guest defaults
authorChao Gao <chao.gao@intel.com>
Thu, 22 May 2025 15:10:05 +0000 (08:10 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Tue, 24 Jun 2025 20:46:32 +0000 (13:46 -0700)
commit7c2c89364d9219f3a31a9a930476de5c154f13bd
tree0deccf59bfaa4a6613962555efdf6ffa2d50c8cc
parent7bc4ed75f2d664c5a96d1f0874c41431a84c62b2
x86/fpu: Initialize guest FPU permissions from guest defaults

Currently, fpu->guest_perm is copied from fpu->perm, which is derived from
fpu_kernel_cfg.default_features.

Guest defaults were introduced to differentiate the features and sizes of
host and guest FPUs. Copying guest FPU permissions from the host will lead
to inconsistencies between the guest default features and permissions.

Initialize guest FPU permissions from guest defaults instead of host
defaults. This ensures that any changes to guest default features are
automatically reflected in guest permissions, which in turn guarantees
that fpstate_realloc() allocates a correctly sized XSAVE buffer for guest
FPUs.

Suggested-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: John Allen <john.allen@amd.com>
Link: https://lore.kernel.org/all/20250522151031.426788-3-chao.gao%40intel.com
arch/x86/kernel/fpu/core.c