[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251222212426.834058-1-pbonzini@redhat.com>
Date: Mon, 22 Dec 2025 22:24:26 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: x86@...nel.org
Subject: [PATCH] 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.
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
---
arch/x86/kernel/fpu/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index c802321acb5d..28d1d25f62d4 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -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)
--
2.52.0
Powered by blists - more mailing lists