Skip to contentSkip to conversation

x86, fpu: check for consistency after loading fpregs

PATCH New Paolo Bonzini 1 participant 1 message Dec 22, 2025

Subsystems (2)
lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 x86, fpu: check for consistency after loading fpregs

fpregs_assert_state_consistent() does nothing if TIF_NEED_FPU_LOAD is set. But in that case the FPU *will* be loaded very soon; move the checks after the load, thus ensuring that they are performed.

---
 arch/x86/kernel/fpu/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/fpu/core.c +2 -2
index c802321acb5d..28d1d25f62d4 100644
@@ -860,10 +860,10 @@ void fpregs_lock_and_load(void)
 
 	fpregs_lock();
 
-	fpregs_assert_state_consistent();
-
 	if (test_thread_flag(TIF_NEED_FPU_LOAD))
 		fpregs_restore_userregs();
+
+	fpregs_assert_state_consistent();
 }
 
 void fpu_load_guest_fpstate(struct fpu_guest *gfpu)
Signature · 1 line
2.52.0